Skip to content

Fix/system assignments issue 143#408

Closed
konac-hamza wants to merge 4 commits intoopenstack-experimental:mainfrom
konac-hamza:fix/system-assignments-issue-143
Closed

Fix/system assignments issue 143#408
konac-hamza wants to merge 4 commits intoopenstack-experimental:mainfrom
konac-hamza:fix/system-assignments-issue-143

Conversation

@konac-hamza
Copy link
Collaborator

@konac-hamza konac-hamza commented Nov 30, 2025

@gtema Following your review, I did not modify any SeaORM tables or models.
I updated the implementation to follow the same logic used in the list method.
Looking forward to your feedback. Thank you!

Copy link
Collaborator

@gtema gtema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. Few smaller issues.

let mut select = DbAssignment::find();
let mut select_system = DbSystemAssignment::find();
// flags of actors and role ID matches as boolean expressions
let include_system = params.targets.is_empty(); // Track if we should query system table
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the database level we still have target_id also for system assignments (in the system_role_assignment table there is target_id). On practice it is always "system" currently. On the API level it is also expected that the user passes scope.system=XXX to query system assignments. So the part of your previous attempt with adding system scope into the target parameters was partially correct. We need to extend the RoleAssignmentTarget with the enum specifying what the target_id is pointing to (project, domain, system). Here we would need to iterate over the targets and when there is a system target - do the querying. I would suggest - prepare the query and only decide whether to execute it or not based on the logic (i.e. during iterating over the targets also check if there are system assignments and raise a flag). This will help to keep less of the if guards

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am adding the target type in the #416

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am adding the target type in the #416

I will update the PR by the new types. Thank you for the updates.

.collect::<Result<Vec<_>, _>>()?
} else {
Vec::new() // Don't query system table if not needed
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can query both tables in parallel just like it is done for users https://github.com/openstack-experimental/keystone/blob/main/src/identity/backends/sql/user/list.rs#L58. If you don't feel confident in that leave it like that and I will add it later.

@konac-hamza konac-hamza force-pushed the fix/system-assignments-issue-143 branch from 86249ca to 420df3f Compare December 4, 2025 22:57
Integrate RoleAssignmentTargetType and simplify queries.
@konac-hamza konac-hamza force-pushed the fix/system-assignments-issue-143 branch from 420df3f to f6bd709 Compare December 6, 2025 03:18
@konac-hamza konac-hamza closed this Dec 6, 2025
@konac-hamza konac-hamza deleted the fix/system-assignments-issue-143 branch December 6, 2025 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments