Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
jijisa
/
porch
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
70eeaa53
authored
Apr 10, 2017
by
Heechul Kim
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Added ADMIN_ID in app.py
parent
94fa005a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletions
porch/app.py
porch/app.py
View file @
70eeaa53
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment