Target Individuals for Certificates (#384)

* Allowing individual users to be targeted for a role.

* Ensuring that even new users get a per user-role
This commit is contained in:
kevgliss 2016-07-01 09:04:39 -07:00 committed by GitHub
parent a04f707f63
commit e34de921b6
1 changed files with 6 additions and 0 deletions

View File

@ -97,6 +97,7 @@ class Login(Resource):
# Tell Flask-Principal the identity changed # Tell Flask-Principal the identity changed
identity_changed.send(current_app._get_current_object(), identity_changed.send(current_app._get_current_object(),
identity=Identity(user.id)) identity=Identity(user.id))
metrics.send('successful_login', 'counter', 1) metrics.send('successful_login', 'counter', 1)
return dict(token=create_token(user)) return dict(token=create_token(user))
@ -190,6 +191,11 @@ class Ping(Resource):
role = role_service.create(group, description='This is a google group based role created by Lemur') role = role_service.create(group, description='This is a google group based role created by Lemur')
roles.append(role) roles.append(role)
role = role_service.get_by_name(profile['email'])
if not role:
role = role_service.create(profile['email'], description='This is a user specific role')
roles.append(role)
# if we get an sso user create them an account # if we get an sso user create them an account
if not user: if not user:
# every user is an operator (tied to a default role) # every user is an operator (tied to a default role)