diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-11 08:54:41 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-11 08:54:41 -0600 |
| commit | 91dd070fa8a24df1886d59eee6d484be4647c9e3 (patch) | |
| tree | 4687b2d9e13d1fad04e57bb6550a633cd1058cc9 /src/authorization/entities.rs | |
| parent | 6721aaffa33894624c87a54f4ed10eccd3c080e5 (diff) | |
feat: import project policiesgl-policies
Diffstat (limited to 'src/authorization/entities.rs')
| -rw-r--r-- | src/authorization/entities.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/authorization/entities.rs b/src/authorization/entities.rs index fc1246d7..8d7d178f 100644 --- a/src/authorization/entities.rs +++ b/src/authorization/entities.rs @@ -46,6 +46,16 @@ impl EntitiesRepository { let project = self.api.get_project(&project_path).await?; + // Create member list first + let member_ids: Vec<String> = self + .api + .get_project_members(project.id) + .await? + .iter() + .filter(|m| m.state == "active") + .map(|m| format!("User::\"{}\"", m.id)) + .collect(); + entities.push(CedarEntity { uid: CedarUid { entity_type: "Project".to_string(), @@ -54,7 +64,10 @@ impl EntitiesRepository { attrs: serde_json::json!({ "name": project.name, "path": project.path, - "full_path": format!("{}/{}", project.namespace.full_path, project.path), + "full_path": project.path_with_namespace, + "visibility": project.visibility, + "archived": project.archived.unwrap_or(false), + "members": member_ids, }), parents: if project.namespace.kind == "group" { vec![CedarParent { @@ -66,6 +79,7 @@ impl EntitiesRepository { }, }); + // Get all members again to create User entities for member in self.api.get_project_members(project.id).await? { if member.state == "active" { entities.push(CedarEntity { @@ -76,6 +90,9 @@ impl EntitiesRepository { attrs: serde_json::json!({ "username": member.username, "access_level": member.access_level, + "admin": false, // Would need to fetch from user API for real admin status + "blocked": false, // Would need to fetch from user API for real blocked status + "external": false, // Would need to fetch from user API for real external status }), parents: vec![], }); @@ -133,6 +150,8 @@ impl EntitiesRepository { "name": group.name, "path": group.path, "full_path": group.full_path, + "visibility": "private", // Groups don't have visibility in our simplified model + "members": [], // Would need group members API to populate }), parents, }); |
