diff options
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, }); |
