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

api, pkg: refactor guard package #1834

Merged
merged 7 commits into from
Apr 22, 2022
Merged

api, pkg: refactor guard package #1834

merged 7 commits into from
Apr 22, 2022

Conversation

henrybarreto
Copy link
Member

@henrybarreto henrybarreto commented Apr 1, 2022

guard and authorizer were splitting the same responsibility, help ShellHub
to control the roles.

In a package, authorizer, were all role, actions and permissions, and another,
guard, were all logic to validate if a role has permission to execute an action,
what obligated the programmer change at two district places when he/she wants
to add a permission, action or role.

The old authorizer package was not remove, but marked as "deprecated", so we
can remove its call at pieces.

Some comments on guard were improved too, giving more precise description
and code usage examples.

api/pkg/guard/guard.go Outdated Show resolved Hide resolved
api/pkg/guard/guard.go Outdated Show resolved Hide resolved
@henrybarreto henrybarreto marked this pull request as ready for review April 20, 2022 12:33
guard and authorizer were splitting the same responsibility, help ShellHub
to control the roles.

In a package, authorizer, were all role, actions and permissions, and another,
guard, were all logic to validate if a role has permission to execute an
action, what obligated the programmer change at two district places when he/she
wants to add a permission, action or role.

The old authorizer package was not remove, but marked as "deprecated", so we
can remove its call at pieces.

Some comments on guard were improved too, giving more precise description and
code usage examples.
api/pkg/guard/guard.go Show resolved Hide resolved
@otavio otavio merged commit e5392c7 into master Apr 22, 2022
@otavio otavio deleted the refactor/guard branch April 22, 2022 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api go Pull requests that update Go code kind/refactor product/cloud Issue/PR related to Cloud Edition status/needs-review status/require-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants