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

feat: permissions refactor, added create permissions #264

Merged
merged 10 commits into from
Dec 4, 2024

Conversation

golanglemonade
Copy link
Member

@golanglemonade golanglemonade commented Dec 3, 2024

  • Updates the fga model to allow for additional object creation permissions based on group membership, tests added to each create to test for access
  • Updates the ent template to include a basic policy for new schemas
  • Upgrades iam dependency (which cleans up a lot of unnecessary code in the auth_checks.go generated file and adds some helper wrappers)
  • Adds a new policy package (internal/ent/privacy/policy/base.go) to make writing the policies in the schemas cleaner using With options
  • Should be a 1:1 replacement in all the schemas of the old policies -> new policies - only additional create policies were added to schemas
  • mixins in the schema package were all renamed to be prefixed with mixin_ to make them easier to find (they need to live in the schema package because they have dependencies on the package itself
  • Two mixins added/updated:
    • internal/ent/schema/mixin_createacess.go : adds the to/from fields for org -> group access and adds the hooks for adding tuples to fga. This currently contains a manual list of objects types, I want to follow-up later to see if these can be pulled based on annotations in the schema instead
    • internal/ent/schema/mixin_grouppermissions.go: updates to add the reverse edges to the group schema so we don't have to manually add three fields for every editor/viewer/blocked group
  • Updates testing suite to output error logs when using the -v flag; removed the -v flag from the task command that runs in CI.

Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
@golanglemonade golanglemonade marked this pull request as ready for review December 3, 2024 22:41
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
fga/model/model.fga Show resolved Hide resolved
internal/ent/privacy/policy/base.go Show resolved Hide resolved
pkg/middleware/auth/auth.go Show resolved Hide resolved
internal/ent/privacy/policy/base.go Outdated Show resolved Hide resolved
internal/ent/privacy/policy/checks.go Outdated Show resolved Hide resolved
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
@golanglemonade golanglemonade enabled auto-merge (squash) December 4, 2024 00:59
@golanglemonade golanglemonade merged commit 88306f3 into main Dec 4, 2024
14 checks passed
@golanglemonade golanglemonade deleted the feat-create-perms-by-group-3 branch December 4, 2024 01:17
Copy link

sonarcloud bot commented Dec 4, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants