Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more fields in the role editor #51458

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bl-nero
Copy link
Contributor

@bl-nero bl-nero commented Jan 24, 2025

This PR adds the following fields:

  • DB service labels
  • Kubernetes users
  • where clause in access rules. I took liberty to call it "Condition" in the UI, so please voice your opinion on whether this is a good choice. My line of reasoning is that without understanding the underlying YAML model, the name "Where" would be confusing.

The intent behind this PR was to fully support the access role in the rich UI, but it turned out that one more field was added to it, so we still miss the target. However, I added warnings to the Go codebase now, so hopefully, this will make it easier to prevent these situations in future.

Screenshot 2025-01-24 at 13 59 46
Screenshot 2025-01-24 at 13 59 24
Screenshot 2025-01-24 at 13 59 07

Requires #51457

@bl-nero bl-nero changed the title Add remaining role fields to support the built-in roles in the editor Support more fields to the role editor Jan 24, 2025
@bl-nero bl-nero force-pushed the bl-nero/role-editor-more-fields branch from e946468 to 4ebf9db Compare January 24, 2025 13:07
@bl-nero bl-nero marked this pull request as ready for review January 24, 2025 13:07
@github-actions github-actions bot requested review from kimlisa and rudream January 24, 2025 13:08
@bl-nero bl-nero added the no-changelog Indicates that a PR does not require a changelog entry label Jan 24, 2025
<Text typography="body3" mb={1}>
Labels
</Text>
<FieldSelectCreatable
Copy link
Contributor

Choose a reason for hiding this comment

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

the inputs placeholder says Select..., are we supposed to have a list of users to select? or maybe replace with Start typing a user and press enter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea; added in other places, too.

/>
</Box>
<LabelsInput
legend="Labels"
Copy link
Contributor

Choose a reason for hiding this comment

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

should we also add a tooltip explaining labels as well?

/>
<LabelsInput
legend="Database Service Labels"
tooltipContent="The database service labels have no influence on which databases' access is controlled by this role. Instead, they control which database services are discoverable while enrolling a new database."
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead, they control which database services are discoverable while enrolling a new database.

tbh, i didn't understand what this means 😢, can we simplify it? The ai doc says:

image

Copy link
Contributor Author

@bl-nero bl-nero Jan 27, 2025

Choose a reason for hiding this comment

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

@kimlisa Take a look at this discussion. @marcoandredinis wrote this part, so perhaps you two could help me rephrasing this explanation to be easier to understand?

Copy link
Contributor

@marcoandredinis marcoandredinis Jan 27, 2025

Choose a reason for hiding this comment

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

I would phrase it like this

The database service labels controls which Database Services (Teleport Agents) are visible to the user. Access to Databases is controlled by the Databased Labels field.

We can add more details if this is not clear.

The database service labels controls which Database Services (Teleport Agents) are visible to the user, required when adding Databases in the Enroll New Resource wizard. Access to Databases is controlled by the Databased Labels field.

Copy link
Contributor

@kimlisa kimlisa Jan 27, 2025

Choose a reason for hiding this comment

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

i think marco's first quote box is good enough, we can perhaps add a link to Database Service that explains what it is too

or this is good too:

The database service labels have no influence on which databases' access is controlled by this role. Instead, they control which Database Services (Teleport Agents) are visible to the user."

@@ -112,6 +115,26 @@ const AccessRule = memo(function AccessRule({
value={verbs}
onChange={v => setRule({ ...value, verbs: v })}
rule={precomputed(validation.fields.verbs)}
/>
<FieldInput
label="Condition"
Copy link
Contributor

Choose a reason for hiding this comment

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

personally i think it's okay to label it this way, but i'd also double check with product team because we try to teach users consistent wording

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After consulting UX/Product, we decided to rename it to Filter.

Comment on lines 123 to 132
Additional condition, expressed using the{' '}
<Text
as="a"
href="https://goteleport.com/docs/reference/predicate-language/"
target="_blank"
color={theme.colors.interactive.solid.accent.default}
>
Teleport predicate language
</Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

what about something like: Optional condition further limiting the scope for this rule expressed using the ....

@bl-nero bl-nero changed the title Support more fields to the role editor Support more fields in the role editor Jan 27, 2025
Base automatically changed from bl-nero/fieldinput-labelsinput to master January 27, 2025 17:30
@bl-nero bl-nero force-pushed the bl-nero/role-editor-more-fields branch from 4ebf9db to cdcd860 Compare January 29, 2025 17:08
@bl-nero
Copy link
Contributor Author

bl-nero commented Jan 29, 2025

Sorry for the force-push, I had to reconcile a messed up merge of the PR that I was depending on here.

Copy link
Contributor

@marcoandredinis marcoandredinis left a comment

Choose a reason for hiding this comment

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

Descriptions look good 👍
Just left a comment (no blocker)

lib/services/presets.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v17 no-changelog Indicates that a PR does not require a changelog entry size/md ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants