Access-Control Management
# spicedb
t
I am looking to implement fine grained permissions as described [here](https://authzed.com/docs/spicedb/modeling/access-control-management#fine-grained-access-control) but with inheritance - if the same permission is granted at the org level it is inherited by any child repo. This is what I've come up with, but I am getting a `under permission
create_issue
under definition `repository`: permissions cannot be used on the left hand side of an arrow (found
org_grants
)` error. Suggestions?
Copy code
definition user {}

definition team {
    relation member: user
}

definition org {
    relation direct_grants: role_grant

    // permissions
    permission create_issue = direct_grants->create_issue
    permission delete_issue = direct_grants->delete_issue

    // export
    permission grants = direct_grants
}

definition repository {
    // imports
    permission org_grants = org->grants

    // belongs to exactly one
    relation org: org

    // grants
    relation direct_grants: role_grant

    // permissions
    permission create_issue = direct_grants->create_issue + org_grants->create_issue
    permission delete_issue = direct_grants->delete_issue + org_grants->delete_issue
}

// Definition of role grants
// A role grant assigns the permissions of a role to a user or team
definition role_grant {
    relation role: role
    relation grantee: user | team#member
    permission create_issue = role->create_issue & grantee
    permission delete_issue = role->delete_issue & grantee
}

// Definition of roles
// Each role defines a set of permissions that can be granted to users or teams
definition role {
    relation create_issue: user:*
    relation delete_issue: user:*
}
y
if the idea is that you're trying to make two hops, you need to have an intermediate permission on the intermediate definition
like it sounds like you want something like this? https://github.com/authzed/spicedb/issues/15
t
Yeah, been watching that one. In the mean, time your suggestion helps.
13 Views