Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Display the roles of the logged-in user in the Web Debug Toolbar#42800

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@NicoHaase
Copy link
Contributor

QA
Branch?5.4 for features
Bug fix?no
New feature?yes
Deprecations?yes/no
TicketsFix#42763
LicenseMIT
Doc PR-

This PR adds the roles of the logged-in user to the WDT

Bilge reacted with rocket emoji
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 5.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot


<divclass="sf-toolbar-info-piece">
<b>Roles</b>
<span>{{collector.roles|join(',') }}</span>
Copy link
Member

Choose a reason for hiding this comment

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

Should we limit the output here? I'm afraid we break the toolbar for apps with many roles. 🙈

Copy link
Contributor

Choose a reason for hiding this comment

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

was checking 😬 i have 200+ roles :}

Copy link
Member

Choose a reason for hiding this comment

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

😱

Copy link
Contributor

Choose a reason for hiding this comment

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

yes. It's a symptom of permissions-as-roles. In that sense ive no idea what a reasonable no. of roles is, nor about an average role name length. I do agree the current toolbar has limited UI to display many data.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yeah, good point - limiting would be a good idea. Do you have any preference about this. I would see the following options:

  • showing the first m roles, and something like "and n more"
  • having something like a modal that could be opened if there are more than m roles

Copy link
Contributor

Choose a reason for hiding this comment

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

this should not only contain the number of assigned roles

hence i suggested to use a title attribute and avoid this discussion :)

Copy link
Member

Choose a reason for hiding this comment

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

I like@ro0NL's suggestion of using the title attribute:

image

I think 1 role is a good threshold value 😄 . In this example screenshot, the user only has 4 roles and it already wouldn't fit the normal modal.
Also, I always recommend people to limit the number of roles a user has as close to 1 as possible. Maybe complex applications need 3+ roles, but generally you should be able to manage 1 or 2 roles if you split roles from permissions.

fd6130, ro0NL, and fabpot reacted with thumbs up emoji
Copy link
Contributor

@ro0NLro0NLSep 5, 2021
edited
Loading

Choose a reason for hiding this comment

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

i agree the dashed underline is likely enough to trigger a user hover, and go from there.

i'd opt out from a random number to display roles for

we could spare out "Logged in as" in favor of the "user icon" as in the toolbar itself, if it's not redundant already :}

we could spare out "Authenticated: yes" in favor of the negative edge case (eg. "Not authenticated" as a single badge)

"Action" looks redundant :) could be some "logout icon" too

last but not least, IIUC the title attribute is limited to 512 chars. Perhaps we should invent some CSS only tooltip util.

Copy link
Member

Choose a reason for hiding this comment

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

Please keep this discussion focussed and discuss cleaning up other things in another issue/pr :)

I'm 100% in favor of keeping this as simple as possible. Let's not increase difficulty with CSS/js tooltips. The longest role I've seen is Symfony's ownROLE_PREVIOUS_ADMIN, which is 19 characters long (meaning a user can have 24 roles before the title attribute overflows).

Copy link
Contributor

@ro0NLro0NLSep 5, 2021
edited
Loading

Choose a reason for hiding this comment

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

I never implied "JS". We have a hard limit on title attributes.

edit: the 512 limit is IE only it seems. Max-width is default on title attributes ... let's do that 👍

@NicoHaase
Copy link
ContributorAuthor

So, I'm having a new shot after all that feedback - thank you guys for commenting!

Bildschirmfoto von 2021-09-06 07-59-54

@NicoHaaseNicoHaaseforce-pushed thefeature/list-roles-in-toolbar-42763 branch fromec98d71 to1460732CompareSeptember 6, 2021 06:03
@derrabus
Copy link
Member

@ro0NL Can you test this PR with your 200+ roles app? 🙃

Copy link
Member

@wouterjwouterj left a comment

Choose a reason for hiding this comment

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

Looks great :)

@fabpot
Copy link
Member

Thank you@NicoHaase.

@fabpotfabpot merged commit47385e5 intosymfony:5.4Sep 6, 2021
@NicoHaaseNicoHaase deleted the feature/list-roles-in-toolbar-42763 branchSeptember 6, 2021 09:12
derrabus added a commit that referenced this pull requestSep 13, 2021
… Toolbar -- bugfix for two roles (NicoHaase)This PR was merged into the 5.4 branch.Discussion----------Display the roles of the logged-in user in the Web Debug Toolbar -- bugfix for two roles| Q             | A| ------------- | ---| Branch?       | 5.4 for features| Bug fix?      | yes| New feature?  | yes| Deprecations? | no| Tickets       | Additional fix for#42763| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->The first commit from#42800 did not work properly if there are exactly two roles assigned to the logged in user (as then, the first would be shown, but not the "and n more" span). This PR fixes this issueCommits-------895df9f Display the roles of the logged-in user in the Web Debug Toolbar -- bugfix
This was referencedNov 5, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@wouterjwouterjwouterj approved these changes

@derrabusderrabusderrabus approved these changes

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

+2 more reviewers

@ro0NLro0NLro0NL left review comments

@fd6130fd6130fd6130 left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Show user roles in web developer toolbar security widget

7 participants

@NicoHaase@carsonbot@derrabus@fabpot@wouterj@ro0NL@fd6130

[8]ページ先頭

©2009-2025 Movatter.jp