Commit 70eeaa53 by Heechul Kim

Added ADMIN_ID in app.py

parent 94fa005a
Showing with 2 additions and 1 deletions
...@@ -9,6 +9,7 @@ from flask_jwt_extended import JWTManager ...@@ -9,6 +9,7 @@ from flask_jwt_extended import JWTManager
from flask_cors import CORS, cross_origin from flask_cors import CORS, cross_origin
from porch import settings from porch import settings
from porch.config import ADMIN_ID
from porch.config import JWT_SECRET_KEY from porch.config import JWT_SECRET_KEY
from porch.config import JWT_ACCESS_TOKEN_EXPIRES from porch.config import JWT_ACCESS_TOKEN_EXPIRES
...@@ -26,7 +27,7 @@ app.secret_key = JWT_SECRET_KEY ...@@ -26,7 +27,7 @@ app.secret_key = JWT_SECRET_KEY
jwt = JWTManager(app) jwt = JWTManager(app)
@jwt.user_claims_loader @jwt.user_claims_loader
def add_claims_to_access_token(identity): def add_claims_to_access_token(identity):
s_role = 'admin' if identity == 'admin' else 'user' s_role = 'admin' if identity == ADMIN_ID else 'user'
return { return {
'id': identity, 'id': identity,
'role': s_role 'role': s_role
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment