Ejemplo n.º 1
0
    def create_role_with_permissions(self, role_id, permission_ids):
        role = authorization_service.create_role(role_id, role_id)

        for permission_id in permission_ids:
            permission = authorization_service.create_permission(permission_id, permission_id)
            authorization_service.assign_permission_to_role(permission, role)

        return role
Ejemplo n.º 2
0
def create_role_with_permissions(role_id, permission_ids):
    role = authorization_service.create_role(role_id, role_id)

    for permission_id in permission_ids:
        permission = authorization_service.create_permission(
            permission_id, permission_id)
        authorization_service.assign_permission_to_role(permission.id, role.id)

    return role
Ejemplo n.º 3
0
def create_role_with_permissions(role_id, role_title, permissions_and_titles):
    role = authorization_service.create_role(role_id, role_title)

    for permission_enum_member, permission_title in permissions_and_titles:
        permission_id = permission_enum_member.__key__

        permission = authorization_service.create_permission(permission_id,
                                                             permission_title)
        authorization_service.assign_permission_to_role(permission, role)
Ejemplo n.º 4
0
def create_role_with_permissions(role_id, role_title, permissions_and_titles):
    role = authorization_service.create_role(role_id, role_title)

    for permission_enum_member, permission_title in permissions_and_titles:
        permission_id = permission_enum_member.__key__

        permission = authorization_service.create_permission(permission_id,
                                                             permission_title)
        authorization_service.assign_permission_to_role(permission, role)
    def setUp(self):
        super().setUp()

        self.permission_id = 'board_topic_hide'
        self.permission = service.create_permission(self.permission_id,
                                                    self.permission_id)

        self.role_id = 'board_moderator'
        self.role = service.create_role(self.role_id, self.role_id)
Ejemplo n.º 6
0
def assign_permissions_to_user(user, role_id, permission_ids):
    """Create the role and permissions, assign the permissions to the
    role, and assign the role to the user.
    """
    role = authorization_service.create_role(role_id, role_id)

    for permission_id in permission_ids:
        permission = authorization_service.create_permission(permission_id,
                                                             permission_id)
        authorization_service.assign_permission_to_role(permission, role)

    authorization_service.assign_role_to_user(role, user)
Ejemplo n.º 7
0
def assign_permissions_to_user(user_id, role_id, permission_ids):
    """Create the role and permissions, assign the permissions to the
    role, and assign the role to the user.
    """
    role = authorization_service.create_role(role_id, role_id)

    for permission_id in permission_ids:
        permission = authorization_service.create_permission(
            permission_id, permission_id)
        authorization_service.assign_permission_to_role(permission.id, role.id)

    authorization_service.assign_role_to_user(user_id, role.id)
Ejemplo n.º 8
0
def create_permissions(permissions):
    for permission in permissions:
        authz_service.create_permission(permission['id'], permission['title'])
Ejemplo n.º 9
0
def permission():
    return service.create_permission(PERMISSION_ID, 'Hide board topics')
Ejemplo n.º 10
0
def permission():
    return service.create_permission('board_topic_hide', 'Hide board topics')
Ejemplo n.º 11
0
def permission():
    return authorization_service.create_permission('board_topic_hide',
                                                   'Hide board topics')