Skip to content

Commit

Permalink
Add Auth Decorator (mitre#1001)
Browse files Browse the repository at this point in the history
  • Loading branch information
wbooth authored and david committed Jan 7, 2020
1 parent 1576ca0 commit 8b5c9a0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/service/auth_svc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
from app.utility.base_service import BaseService


def check_authorization(func):
async def process(func, *args, **params):
return await func(*args, **params)

async def helper(*args, **params):
await args[0].auth_svc.check_permissions(args[1])
result = await process(func, *args, **params)
return result
return helper


class AuthService(BaseService):

User = namedtuple('User', ['username', 'password', 'permissions'])
Expand Down

0 comments on commit 8b5c9a0

Please sign in to comment.