Esempio n. 1
0
def test_get_permission_ids_for_user(party_app_with_db, admin_user,
                                     normal_user):
    user_id = normal_user.id
    initiator_id = admin_user.id

    permissions_before = authorization_service \
        .get_permission_ids_for_user(user_id)
    assert permissions_before == frozenset()

    assign_permissions_to_user(user_id,
                               'board_moderator', {
                                   'board_topic_hide',
                                   'board_topic_pin',
                               },
                               initiator_id=initiator_id)
    assign_permissions_to_user(user_id,
                               'news_editor', {
                                   'news_item_create',
                               },
                               initiator_id=initiator_id)

    permissions_after = authorization_service \
        .get_permission_ids_for_user(user_id)
    assert permissions_after == {
        'board_topic_hide',
        'board_topic_pin',
        'news_item_create',
    }
Esempio n. 2
0
    def create_admin(self):
        admin = self.create_user('Admin')

        permission_ids = {'admin.access', 'newsletter.export_subscribers'}
        assign_permissions_to_user(admin.id, 'admin', permission_ids)

        self.create_session_token(admin.id)

        return admin
Esempio n. 3
0
    def create_admin(self):
        admin = create_user('Admin')

        permission_ids = {'admin.access', 'shop_order.view'}
        assign_permissions_to_user(admin.id, 'admin', permission_ids)

        login_user(admin.id)

        return admin
Esempio n. 4
0
def newsletter_admin():
    admin = create_user('NewsletterAdmin')

    permission_ids = {'admin.access', 'newsletter.export_subscribers'}
    assign_permissions_to_user(admin.id, 'admin', permission_ids)

    login_user(admin.id)

    return admin
Esempio n. 5
0
    def create_admin(self):
        admin = self.create_user('Admin')

        permission_ids = {'admin.access', 'shop_order.update'}
        assign_permissions_to_user(admin.id, 'admin', permission_ids)

        self.create_session_token(admin.id)

        return admin
Esempio n. 6
0
    def create_admin(self):
        admin = create_user('Admin')

        permission_ids = {
            'admin.access',
            'shop_order.cancel',
            'shop_order.mark_as_paid',
        }
        assign_permissions_to_user(admin.id, 'admin', permission_ids)

        login_user(admin.id)

        return admin
Esempio n. 7
0
 def setup_admin(self):
     permission_ids = {'admin.access', 'newsletter.export_subscribers'}
     assign_permissions_to_user(self.admin.id, 'admin', permission_ids)
Esempio n. 8
0
 def setup_admin(self):
     permission_ids = {'admin.access', 'shop_order.view'}
     assign_permissions_to_user(self.admin.id, 'admin', permission_ids)
Esempio n. 9
0
 def setup_admin(self, permission_id):
     permission_ids = {'admin.access', permission_id}
     assign_permissions_to_user(self.admin, 'admin', permission_ids)
Esempio n. 10
0
 def setup_admin(self):
     permission_ids = {'admin.access', 'shop_order.view'}
     assign_permissions_to_user(self.admin, 'admin', permission_ids)
Esempio n. 11
0
 def setup_admin(self, permission_id):
     permission_ids = {'admin.access', permission_id}
     assign_permissions_to_user(self.admin.id, 'admin', permission_ids)
Esempio n. 12
0
def setup_admin_with_permission(admin_id, permission_id):
    permission_ids = {'admin.access', permission_id}
    assign_permissions_to_user(admin_id, 'admin', permission_ids)
Esempio n. 13
0
 def setup_admin(self):
     permission_ids = {"admin.access", "shop_order.update"}
     assign_permissions_to_user(self.admin, "admin", permission_ids)