def grant_role(self, role, object): object_id = 0 if not isclass(object): object_id = object.id content_type = get_content_type_for_model(object) act = Role.get_by_name(role) perm = Permission(role=act, group=self, content_type=content_type, object_id=object_id) perm.save() self.invalidate_permission_tree_for_members()
def grant_role(self, role, object): object_id = 0 if not isclass(object): object_id = object.id content_type = get_content_type_for_model(object) act = Role.get_by_name(role) perm = Permission( role=act, group=self, content_type=content_type, object_id=object_id ) perm.save() self.invalidate_permission_tree_for_members()
def grant_role(self, role, object): """ Make it possible to set permissions for classes """ object_id = 0 if not isclass(object): object_id = object.id content_type = get_content_type_for_model(object) act = Role.get_by_name(role) perm = Permission( role=act, user=self, content_type=content_type, object_id=object_id ) perm.save() self.invalidate_permission_tree()