Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_anonymous, login_required, has_permission helpers #114

Merged
merged 4 commits into from
Nov 17, 2017

Conversation

litwisha
Copy link
Contributor

@litwisha litwisha commented Nov 17, 2017

Helper functions and decorators.

is_anonymous(request)
  • gets request and returns True if user is not authorized and False if user is authorized.
@login_required
  • decorates handlers and allow access only for authorized users.
has_permission(permission)
  • decorates handlers and allow access only for authorized users with permission.

Copy link
Member

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation update is required: you have added 3 new public functions

def wrapped(*args, **kwargs):
request = args[-1]
if not isinstance(request, web.BaseRequest):
msg = 'Incorrect decorator usage. ' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use brackets instead of backslash

def wrapped(*args, **kwargs):
request = args[-1]
if not isinstance(request, web.BaseRequest):
msg = 'Incorrect decorator usage. ' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brackets

@codecov
Copy link

codecov bot commented Nov 17, 2017

Codecov Report

Merging #114 into master will decrease coverage by 1.67%.
The diff coverage is 91.41%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #114      +/-   ##
==========================================
- Coverage   97.03%   95.36%   -1.68%     
==========================================
  Files          10       10              
  Lines         405      561     +156     
  Branches        8       18      +10     
==========================================
+ Hits          393      535     +142     
- Misses         10       20      +10     
- Partials        2        6       +4
Impacted Files Coverage Δ
aiohttp_security/__init__.py 100% <100%> (ø) ⬆️
aiohttp_security/api.py 90.69% <80.95%> (-9.31%) ⬇️
tests/test_dict_autz.py 95.95% <94.95%> (-1.64%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 810312b...0201663. Read the comment docs.

@asvetlov asvetlov merged commit 92e6fec into aio-libs:master Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants