Skip to content
New issue

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

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

Already on GitHub? # to your account

is_available method needed #217

Closed
jace opened this issue Mar 2, 2019 · 1 comment
Closed

is_available method needed #217

jace opened this issue Mar 2, 2019 · 1 comment
Assignees

Comments

@jace
Copy link
Member

jace commented Mar 2, 2019

Both the requires_permission and the forthcoming requires_roles decorators (in ModelView; see #179) should provide an is_available method that returns True if a call to the decorated function will be allowed by the decorator under current conditions. Templates can use this to determine whether to show functionality to the user.

Currently templates do their own testing using obj.current_roles.role or current_auth.permissions.perm. This is risky because it can go wrong in either direction. Templates may incorrectly assume that the user has access to some functionality, or worse, templates may assume no access while the backend does in fact provide access, leading to security vulnerabilities. If templates use the same testing mechanism as the backend, we get closer to WYSIWYG UI, making it easier to spot misconfiguration.

@jace
Copy link
Member Author

jace commented Mar 12, 2019

Closed in #219.

@jace jace closed this as completed Mar 12, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant