Пример #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
def rightTranslationManage():
    return aclRight(
        NC_('security', 'Translation manage'),
        NC_(
            'security', '''
    Allows for the modification of translatable messages that the application uses.'''
        ))
Пример #4
0
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
 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
def rightTranslationAccess():
    return aclRight(
        NC_('security', 'Translation access'),
        NC_('security', '''
    Allows read only access to the translation files.'''))
Пример #12
0
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'))