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

Policies authorization: legacy code or undefined rules #1389

Open
sofyalaski opened this issue Aug 21, 2024 · 0 comments
Open

Policies authorization: legacy code or undefined rules #1389

sofyalaski opened this issue Aug 21, 2024 · 0 comments
Labels
invalid This doesn't seem right

Comments

@sofyalaski
Copy link
Contributor

sofyalaski commented Aug 21, 2024

Policies authorization: legacy code or undefined rules

Summary

Policies controller file includes authorization check based on these rules:

const canViewAll = ability.can(Action.ListAll, Policy);
const canViewTheirOwn = ability.can(Action.ListOwn, Policy);

These rules, however, don't exist in the casl-ability.factory.ts. Since they don't exist, the ability would be evaluated to false. Then the whole function updateMergedFiltersForList in policies.controller.ts is redundant as it's main purpose is to modify the filters, which would only happen based on if condition that is never met.
This function is probably left there unchanged after some changes were made.
I don't know exactly what policies are supposed to do. So I don't quite understand if it's legacy code or something that was not restructured during changes.

@sofyalaski sofyalaski added the invalid This doesn't seem right label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant