Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Polish

  • Loading branch information...
commit 9a41c264d4debc4279cc4f7c305fa0de86868f70 1 parent 03a25b2
@mattupstate authored
Showing with 6 additions and 17 deletions.
  1. +0 −8 flask_principal/__init__.py
  2. +6 −9 tests/test_principal.py
View
8 flask_principal/__init__.py
@@ -141,15 +141,7 @@ class Identity(object):
def __init__(self, id, auth_type=None):
self.id = id
self.auth_type = auth_type
-
self.provides = set()
- """A set of needs provided by this user
-
- Provisions can be added using the `add` method, for example::
-
- identity = Identity('ali')
- identity.provides.add(('role', 'admin'))
- """
def can(self, permission):
"""Whether the identity has access to the permission.
View
15 tests/test_principal.py
@@ -10,6 +10,12 @@
from flask_principal import Principal, Permission, Denial, RoleNeed, \
PermissionDenied, identity_changed, Identity, identity_loaded
+anon_permission = Permission()
+admin_permission = Permission(RoleNeed('admin'))
+admin_or_editor = Permission(RoleNeed('admin'), RoleNeed('editor'))
+editor_permission = Permission(RoleNeed('editor'))
+admin_denied = Denial(RoleNeed('admin'))
+
def _on_principal_init(sender, identity):
if identity.id == 'ali':
@@ -19,15 +25,6 @@ def _on_principal_init(sender, identity):
class ReraiseException(Exception):
"""For checking reraising"""
-admin_permission = Permission(RoleNeed('admin'))
-anon_permission = Permission()
-
-admin_or_editor = Permission(RoleNeed('admin'), RoleNeed('editor'))
-
-editor_permission = Permission(RoleNeed('editor'))
-
-admin_denied = Denial(RoleNeed('admin'))
-
def mkapp(with_factory=False):
app = Flask(__name__)
Please sign in to comment.
Something went wrong with that request. Please try again.