Beispiel #1
0
    def getRoles(self, principal_id):
        """
        give an Owner who is also a 'selfpublisher', the reviewer role
        """
        context = self.context
        current_roles = list(DefaultLocalRoleAdapter.getRoles(
            self,
            principal_id,
        ))

        # check we are not on the workspace itself
        if IHasWorkspace.providedBy(context):
            return current_roles

        # ignore if we are not Owner
        if 'Owner' not in current_roles:
            return current_roles

        # otherwise we should acquire the workspace and check out roles
        workspace = getattr(context, 'acquire_workspace', lambda: None)()
        if workspace is None:
            return current_roles

        workspace_roles = api.user.get_roles(obj=workspace)
        if 'SelfPublisher' in workspace_roles and 'Owner' in current_roles:
            current_roles.append('Reviewer')

        return current_roles
Beispiel #2
0
    def getRoles(self, principal_id):
        """
        give an Owner who is also a 'selfpublisher', the reviewer role
        """
        context = self.context
        current_roles = list(
            DefaultLocalRoleAdapter.getRoles(
                self,
                principal_id,
            ))

        # check we are not on the workspace itself
        if IHasWorkspace.providedBy(context):
            return current_roles

        # ignore if we are not Owner
        if 'Owner' not in current_roles:
            return current_roles

        # otherwise we should acquire the workspace and check out roles
        workspace = getattr(context, 'acquire_workspace', lambda: None)()
        if workspace is None:
            return current_roles

        workspace_roles = api.user.get_roles(obj=workspace)
        if 'SelfPublisher' in workspace_roles and 'Owner' in current_roles:
            current_roles.append('Reviewer')

        return current_roles
Beispiel #3
0
    def getRoles(self, principal_id):
        """
        give an Owner who is also a 'selfpublisher', the reviewer role
        """
        context = self.context
        current_roles = list(DefaultLocalRoleAdapter.getRoles(
            self,
            principal_id,
        ))

        userid = IMembraneUserObject(context).getUserId()
        if principal_id == userid:
            current_roles.append('Owner')

        return current_roles
Beispiel #4
0
    def getRoles(self, principal_id):
        """
        give an Owner who is also a 'selfpublisher', the reviewer role
        """
        context = self.context
        current_roles = list(
            DefaultLocalRoleAdapter.getRoles(
                self,
                principal_id,
            ))

        userid = IMembraneUserObject(context).getUserId()
        if principal_id == userid:
            current_roles.append('Owner')

        return current_roles