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

[JENKINS-62054] Ensure the Support action is not displayed if the use… #220

Closed
wants to merge 1 commit into from

Conversation

PierreBtz
Copy link
Contributor

…r does not have the proper rights

Copy link
Member

@aheritier aheritier left a comment

Choose a reason for hiding this comment

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

}

boolean shouldDisplay() {
return Jenkins.get().hasPermission(Jenkins.ADMINISTER);
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 Author

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

This is pointing to your same commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah sorry link was bad, I meant:

This is an interesting point, because SupportAction.CREATE_BUNDLE defines a permission (Download Bundle) but the action I linked checks for ADMINISTER :)

I managed to reproduce the issue:

  • have a user with Overall/Read + Job/read + Download Permission
  • go to a job page
  • click on generate bundle (for the job)
  • you won't be allowed to generate the bundle

Question is: is it by design, ie only an admin can retrieve a build directory? Or is it a bug?
If it's a bug, happy to fix it while fixing the action visibility issue.

Copy link

Choose a reason for hiding this comment

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

Maybe @Dohbedoh can better illustrate us.

@@ -22,7 +22,7 @@ public SupportAbstractItemAction(AbstractItem target) {

@Override
public String getDisplayName() {
return Messages.SupportItemAction_DisplayName();
return shouldDisplay() ? Messages.SupportItemAction_DisplayName() : null;
Copy link

Choose a reason for hiding this comment

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

Wouldn't it be possible to implement methods in the super class to avoid having to change every method in the subclasses?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Functionally what you suggest is possible (all action display names are the same) but they are in fact referring to a different message, eg:

I suppose I could build the key to retrieve the message from the class name, but maybe it's worth considering removing the duplication of messages instead. AFAIU, the name will always be Support and the icon will always be the same too. Wdyt?

Copy link

Choose a reason for hiding this comment

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

If the user result is the same, +1 for removing the duplication.

Copy link
Member

Choose a reason for hiding this comment

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

Messages are made unique by #239

@Dohbedoh Dohbedoh added the bug label Oct 30, 2020
@Dohbedoh
Copy link
Contributor

@PierreBtz I proposed #252

@PierreBtz
Copy link
Contributor Author

yeah, my bad for not following up on this...

@PierreBtz PierreBtz closed this Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants