add permission layer for admins for backend API
This commit is contained in:
parent
62187e0b29
commit
907e0ecaab
4 changed files with 33 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from areas.apps.models import AppRole
|
||||
from .models import Role
|
||||
|
||||
|
||||
|
|
@ -10,3 +11,7 @@ class RoleService:
|
|||
@staticmethod
|
||||
def get_role_by_id(role_id):
|
||||
return Role.query.filter_by(id=role_id).first()
|
||||
|
||||
def is_user_admin(userId):
|
||||
dashboard_role_id = AppRole.query.filter_by(user_id=userId, app_id=1).first().role_id
|
||||
return dashboard_role_id == 1
|
||||
Reference in a new issue