authz.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:treadmill 作者: Morgan-Stanley 项目源码 文件源码
def authorize(authorizer):
    """Constructs authorizer decorator."""

    @decorator.decorator
    def decorated(func, *args, **kwargs):
        """Decorated function."""
        action = getattr(func, 'auth_action', func.__name__.strip('_'))
        resource = getattr(func, 'auth_resource', func.__module__.strip('_'))
        _LOGGER.debug('Authorize: %s %s %r %r', resource, action, args, kwargs)
        authorizer.authorize(resource, action, args, kwargs)
        return func(*args, **kwargs)

    return decorated
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号