コード例 #1
0
ファイル: _test_authorization.py プロジェクト: stpierre/pulp
 def test_user_update_success(self):
     u = self._create_user()
     r = self._create_resource()
     o = authorization.UPDATE
     n = authorization.operation_to_name(o)
     authorization.grant_permission_to_user(r, u['login'], [n])
     self.assertTrue(authorization.is_authorized(r, u, o))
コード例 #2
0
ファイル: _test_authorization.py プロジェクト: stpierre/pulp
 def test_root_permissions(self):
     u = self._create_user()
     r = self._create_resource()
     o = authorization.READ
     n = authorization.operation_to_name(o)
     authorization.grant_permission_to_user('/', u['login'], [n])
     self.assertTrue(authorization.is_authorized(r, u, o))
コード例 #3
0
ファイル: _test_authorization.py プロジェクト: stpierre/pulp
 def test_parent_permissions(self):
     u = self._create_user()
     r = self._create_resource()
     p = r.rsplit('/', 2)[0] + '/'
     o = authorization.READ
     n = authorization.operation_to_name(o)
     authorization.grant_permission_to_user(p, u['login'], [n])
     self.assertTrue(authorization.is_authorized(r, u, o))
コード例 #4
0
ファイル: _test_authorization.py プロジェクト: stpierre/pulp
 def test_user_permission_revoke(self):
     u = self._create_user()
     r = self._create_resource()
     o = authorization.READ
     n = authorization.operation_to_name(o)
     authorization.grant_permission_to_user(r, u['login'], [n])
     self.assertTrue(authorization.is_authorized(r, u, o))
     authorization.revoke_permission_from_user(r, u['login'], [n])
     self.assertFalse(authorization.is_authorized(r, u, o))