Example #1
0
    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()
Example #2
0
    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()
Example #3
0
    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()