Skip to content

Commit

Permalink
Support permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
amol- committed Aug 11, 2011
1 parent 203b249 commit 4967b89
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tg/repoze_ming.py
Expand Up @@ -28,12 +28,19 @@ def __init__(self, user_class):

def add_metadata(self, environ, identity):
identity['user'] = self.user_class.query.get(user_name=identity['repoze.who.userid'])
identity['groups'] = identity['user'].groups

if identity['user']:
identity['groups'] = identity['user'].groups
identity['permissions'] = [p.permission_name for p in identity['user'].permissions]
else:
identity['groups'] = []
identity['permissions'] = []

if 'repoze.what.credentials' not in environ:
environ['repoze.what.credentials'] = {}

environ['repoze.what.credentials']['groups'] = identity['groups']
environ['repoze.what.credentials']['permissions'] = identity['permissions']
environ['repoze.what.credentials']['repoze.what.userid'] = identity['repoze.who.userid']

def setup_ming_auth(app, skip_authentication, **auth_args):
Expand Down

0 comments on commit 4967b89

Please sign in to comment.