Skip to content

Commit

Permalink
Fix permission query after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazoyer committed Jul 26, 2024
1 parent a2cb304 commit 8d3cc2c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/infrahub/core/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None:

# ruff: noqa: E501
query = """
MATCH (account:CoreAccount { uuid: $account_id })-[]->(:Relationship {name: "usergroup__users"})<-[]-(group:CoreUserGroup)-[]->(:Relationship {name: "role__usergroups"})<-[]-(role:CoreUserRole)-[]->(:Relationship {name: "role__permissions"})<-[]-(permission:CoreBasePermission)-[:HAS_ATTRIBUTE]->(:Attribute {name: "action"})-[:HAS_VALUE]->(permission_action:AttributeValue)
MATCH (account:CoreGenericAccount { uuid: $account_id })-[]->(:Relationship {name: "usergroup__users"})<-[]-(group:CoreUserGroup)-[]->(:Relationship {name: "role__usergroups"})<-[]-(role:CoreUserRole)-[]->(:Relationship {name: "role__permissions"})<-[]-(permission:CoreBasePermission)-[:HAS_ATTRIBUTE]->(:Attribute {name: "action"})-[:HAS_VALUE]->(permission_action:AttributeValue)
"""

self.add_to_query(query)
Expand Down
9 changes: 8 additions & 1 deletion backend/infrahub/core/schema/definitions/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,14 @@
},
],
"relationships": [
{"name": "tokens", "peer": InfrahubKind.ACCOUNTTOKEN, "optional": True, "cardinality": "many"}
{"name": "tokens", "peer": InfrahubKind.ACCOUNTTOKEN, "optional": True, "cardinality": "many"},
{
"name": "groups",
"peer": InfrahubKind.USERGROUP,
"optional": True,
"identifier": "usergroup__users",
"cardinality": "many",
},
],
},
{
Expand Down

0 comments on commit 8d3cc2c

Please sign in to comment.