refactorign get_user_identity to authorized_userid

This commit is contained in:
Sick Yoon 2016-07-14 19:22:27 +09:00
parent 7091350ff3
commit 3d180ea6b1
1 changed files with 3 additions and 3 deletions

View File

@ -26,7 +26,7 @@ def authorize(required=True, redirect_url=None, permission=None):
coro = asyncio.coroutine(f) coro = asyncio.coroutine(f)
# get identity # get identity
identity = yield from get_user_identity(request) identity = yield from authorized_userid(request)
kwargs['identity'] = identity kwargs['identity'] = identity
if required: if required:
@ -89,7 +89,7 @@ def forget(request, response):
@asyncio.coroutine @asyncio.coroutine
def get_user_identity(request): def authorized_userid(request):
identity_policy = request.app.get(IDENTITY_KEY) identity_policy = request.app.get(IDENTITY_KEY)
if identity_policy is None: if identity_policy is None:
return None return None
@ -119,7 +119,7 @@ def permits(request, permission, context=None):
autz_policy = request.app.get(AUTZ_KEY) autz_policy = request.app.get(AUTZ_KEY)
if autz_policy is None: if autz_policy is None:
return True return True
identity = yield from get_user_identity(request) identity = yield from authorized_userid(request)
access = yield from autz_policy.permits(identity, permission, context) access = yield from autz_policy.permits(identity, permission, context)
return access return access