Ejemplo n.º 1
0
    def _permissionsToEditor(self, user, mode='add'):
        permissions = ['qdjango.view_widget']

        if G3W_EDITOR1 in getUserGroups(user):
            permissions += ['qdjango.change_widget', 'qdjango.delete_widget']

        setPermissionUserObject(user, self, permissions=permissions, mode=mode)
Ejemplo n.º 2
0
    def addPermissionsToEditor(self, user):
        """
        Give guardian permissions to Editor
        """

        permissions = ['view_group']
        if G3W_EDITOR1 in getUserGroups(user):
            permissions += ['change_group', 'delete_group']

        setPermissionUserObject(user, self, permissions=permissions)

        # adding permissions to projects
        appProjects = getProjectsByGroup(self)
        for app, projects in appProjects.items():
            for project in projects:
                project.addPermissionsToEditor(user)
Ejemplo n.º 3
0
    def addPermissionsToEditor(self, user):
        """
        Give guardian permissions to Editor every level
        """

        permissions = ['view_group',
                       'add_project_to_group']  # valid for editor2
        user_groups = getUserGroups(user)
        if G3W_EDITOR1 in user_groups:
            permissions += [
                'add_project_to_group', 'change_group', 'delete_group'
            ]

        setPermissionUserObject(user, self, permissions=permissions)

        # adding permissions to projects
        appProjects = getProjectsByGroup(self)
        for app, projects in list(appProjects.items()):
            for project in projects:
                project.addPermissionsToEditor(user)