def addEntitlementClass(self, authToken, entClass, role):
        """
        Adds a new entitlement class to the server, and populates it with
        an initial role
        """
        cu = self.db.cursor()
        if not self.authCheck(authToken, admin = True):
            raise errors.InsufficientPermission
        self.log(2, "entClass=%s role=%s" % (entClass, role))

        # check for duplicate
        cu.execute("SELECT entGroupId FROM EntitlementGroups WHERE entGroup = ?",
                   entClass)
        if len(cu.fetchall()):
            raise errors.EntitlementClassAlreadyExists

        roleId = self._getRoleIdByName(role)

        cu.execute("INSERT INTO EntitlementGroups (entGroup) "
                   "VALUES (?)", entClass)
        entClassId = cu.lastrowid
        cu.execute("INSERT INTO EntitlementAccessMap (entGroupId, userGroupId) "
                   "VALUES (?, ?)", entClassId, roleId)
        self.db.commit()
dataset/ETHPy150Open sassoftware/conary/conary/repository/netrepos/netauth.py/NetworkAuthorization.addEntitlementClass/original