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)
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
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
def rootRoleId(): roleService = support.entityFor(IRoleService) assert isinstance(roleService, IRoleService) roles = roleService.getAll(limit=1, q=QRole(name='ROOT')) try: rootRole = next(iter(roles)) except StopIteration: rootRole = Role() rootRole.Name = NC_('security role', 'ROOT') rootRole.Description = NC_('security role', 'Default role that provides access to all available roles and rights') return roleService.insert(rootRole) return rootRole.Id
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