示例#1
0
def collaboratorSpecification() -> CollaboratorSpecification:
    b = CollaboratorSpecification()
    b.collaborator_types = [
        NC_('collaborator type', 'Collaborator'),
        NC_('collaborator type', 'Administrator')
    ]
    return b
示例#2
0
def rightRequestsInspection() -> RightAction:
    return gui.actionRight(
        NC_('security', 'Requests inspection'),
        NC_(
            'security', '''
    Allows for the viewing of all possible requests that can be made on the REST server, also the plugins and components
    that are part of the application are also visible.'''))
示例#3
0
文件: acl.py 项目: vivienney/Ally-Py
def rightTranslationManage():
    return aclRight(
        NC_('security', 'Translation manage'),
        NC_(
            'security', '''
    Allows for the modification of translatable messages that the application uses.'''
        ))
示例#4
0
文件: acl.py 项目: vivienney/Ally-Py
def rightTranslationModify():
    return aclRight(
        NC_('security', 'Translation modify'),
        NC_(
            'security', '''
    Allows for the modification of translation files by the upload of updated PO files.'''
        ))
示例#5
0
文件: gui.py 项目: vivienney/Ally-Py
 def actionType() -> TypeAcl:
     b = TypeAcl(
         NC_('security', 'GUI based access control layer'),
         NC_(
             'security',
             'Right type for the graphical user interface based access control layer right setups'
         ))
     acl.acl().add(b)
     return b
示例#6
0
def blogRoleEditorId():
    roleService = support.entityFor(IRoleService)
    assert isinstance(roleService, IRoleService)

    roles = roleService.getAll(limit=1, q=QRole(name='Editor'))
    try: editor = next(iter(roles))
    except StopIteration:
        editor = Role()
        editor.Name = NC_('security role', 'Editor')
        editor.Description = NC_('security role', 'Role that allows editor stuff')
        return roleService.insert(editor)
    return editor.Id
示例#7
0
def blogRoleCollaboratorId():
    roleService = support.entityFor(IRoleService)
    assert isinstance(roleService, IRoleService)

    roles = roleService.getAll(limit=1, q=QRole(name='Collaborator'))
    try: collaborator = next(iter(roles))
    except StopIteration:
        collaborator = Role()
        collaborator.Name = NC_('security role', 'Collaborator')
        collaborator.Description = NC_('security role', 'Role that allows submit to desk and edit his own posts')
        return roleService.insert(collaborator)
    return collaborator.Id
示例#8
0
def blogRoleAdministratorId():
    roleService = support.entityFor(IRoleService)
    assert isinstance(roleService, IRoleService)

    roles = roleService.getAll(limit=1, q=QRole(name='Administrator'))
    try: admin = next(iter(roles))
    except StopIteration:
        admin = Role()
        admin.Name = NC_('security role', 'Administrator')
        admin.Description = NC_('security role', 'Role that allows all rights')
        return roleService.insert(admin)
    return admin.Id
示例#9
0
def menuAction():
    return Action('media-archive',
                  Parent=defaults.menuAction(),
                  Label=NC_('Menu', 'Media Archive'),
                  Href='/media-archive',
                  ScriptPath=getPublishedGui(
                      'media-archive/scripts/js/menu-media-archive.js'))
示例#10
0
def populateRootRole():
    roleService = support.entityFor(IRoleService)
    assert isinstance(roleService, IRoleService)

    roles = roleService.getAll(limit=1, q=QRole(name=NAME_ROOT))
    if not roles:
        rootRole = Role()
        rootRole.Name = NAME_ROOT
        rootRole.Description = NC_('security role', 'Default role that provides access to all available roles and rights')
        roleService.insert(rootRole)
示例#11
0
文件: acl.py 项目: vivienney/Ally-Py
def rightTranslationAccess():
    return aclRight(
        NC_('security', 'Translation access'),
        NC_('security', '''
    Allows read only access to the translation files.'''))
示例#12
0
文件: acl.py 项目: vivienney/Ally-Py
def captcha() -> RightService:
    return RightService(
        'CAPTCHA', NC_('security', 'Right that targets CAPTCHA validations'))
示例#13
0
def rightMediaArchiveUpload() -> RightAction:
    return gui.actionRight(
        NC_('security', 'IAM upload'),
        NC_('security', '''
    Allows upload access to IAM.'''))
示例#14
0
def rightUserView() -> RightAction:
    return gui.actionRight(NC_('security', 'Users view'), NC_('security', '''
    Allows read only access to users.'''))
示例#15
0
def rightManageOwnPost() -> RightAction:
    return gui.actionRight(
        NC_('security', 'Manage own post'),
        NC_(
            'security', '''
    Allows the creation and management of own posts in livedesk.'''))
示例#16
0
@package: security RBAC
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Gabriel Nistor

Contains the setups for populating default data.
'''

from ally.container import support, app, ioc
from ally.internationalization import NC_
from security.rbac.api.rbac import IRoleService, Role, QRole

# --------------------------------------------------------------------

NAME_ROOT = NC_('security role', 'ROOT')  # The name for the root role

# --------------------------------------------------------------------

@ioc.entity
def rootRoleId():
    roleService = support.entityFor(IRoleService)
    assert isinstance(roleService, IRoleService)
    return roleService.getByName(NAME_ROOT).Id

@app.populate(priority=app.PRIORITY_FIRST)
def populateRootRole():
    roleService = support.entityFor(IRoleService)
    assert isinstance(roleService, IRoleService)

    roles = roleService.getAll(limit=1, q=QRole(name=NAME_ROOT))
示例#17
0
def menuAction():
    return Action(
        'sandbox',
        Parent=defaults.menuAction(),
        Label=NC_('Menu', 'Sandbox'),
        Script=publishedURI('superdesk/sandbox/scripts/js/menu-sandbox.js'))
示例#18
0
def rightUserUpdate() -> RightAction:
    return gui.actionRight(NC_('security', 'Users update'), NC_('security', '''
    Allows the update of users.'''))
示例#19
0
def rightMediaArchiveAudioView() -> RightAction:
    return gui.actionRight(NC_('security', 'IAM Audio view'), NC_('security', '''
    Allows read only access to IAM Audio items.''')) 
示例#20
0
def rightLivedeskUpdate() -> RightAction:
    return gui.actionRight(
        NC_('security', 'Livedesk edit'),
        NC_('security', '''
    Allows edit access to users for livedesk.'''))
示例#21
0
def rightLivedeskView() -> RightAction:
    return gui.actionRight(
        NC_('security', 'Livedesk view'),
        NC_('security', '''
    Allows read only access to users for livedesk.'''))
示例#22
0
def menuAction() -> Action:
    return Action('request',
                  NC_('menu', 'Request'),
                  Parent=defaults.menuAction(),
                  NavBar='/api-requests',
                  Script=publishedURI('superdesk/request/scripts/js/menu.js'))
示例#23
0
def rightBlogEdit() -> RightAction:
    return gui.actionRight(
        NC_('security', 'Blog edit'),
        NC_('security', '''
    Allows for editing the blog.'''))
示例#24
0
def menuAction() -> Action:
    return Action('user', Parent=defaults.menuAction(), Label=NC_('menu', 'Users'), NavBar='/users',
                  Script=publishedURI('superdesk/user/scripts/js/menu.js'))
示例#25
0
def menuAction() -> Action:
    return Action('livedesk',
                  Parent=defaults.menuAction(),
                  Label=NC_('menu', 'Live Blogs'))
示例#26
0
def menuAction() -> Action:
    return Action('article',
                  Parent=defaults.menuAction(),
                  Label=NC_('menu', 'Article'),
                  NavBar='/article',
                  Script=publishedURI('superdesk/article/scripts/js/menu.js'))
示例#27
0
def rightArticleView() -> RightAction:
    return gui.actionRight(
        NC_('security', 'Article view'),
        NC_('security', '''
    Allows read only access to Article.'''))
示例#28
0
def menuAction() -> Action:
    return Action('media-archive',
                  Parent=defaults.menuAction(),
                  Label=NC_('menu', 'Media Archive'),
                  NavBar='/media-archive',
                  Script=publishedURI('media-archive/scripts/js/menu.js'))