-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Allow administrative monitors to be displayed for users with Overall/MANAGE
permission
#9437
Allow administrative monitors to be displayed for users with Overall/MANAGE
permission
#9437
Conversation
…/MANAGE` permission This allows users with `Overall/MANAGE` permission but not `Overall/SYSTEM_READ` to display administrative monitors if the administrative monitor has been implemented to allow it.
test/src/test/java/jenkins/management/AdministrativeMonitorsDecoratorTest.java
Outdated
Show resolved
Hide resolved
@@ -201,13 +205,36 @@ public Permission getRequiredPermission() { | |||
return Jenkins.ADMINISTER; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hesitating to deprecate this method, but it still matches simple use cases so went for a javadoc instead.
* <p> | ||
* Changing this permission check to return {@link Jenkins#SYSTEM_READ} will make the active | ||
* administrative monitor appear on {@code manage.jelly} and on the globally visible | ||
* {@link jenkins.management.AdministrativeMonitorsDecorator} to users without Administer permission. | ||
* {@link #doDisable(StaplerRequest, StaplerResponse)} will still always require Administer permission. | ||
* </p> | ||
* <p> | ||
* This method only allows for a single permission to be returned. If more complex permission checks are required, | ||
* override {@link #checkRequiredPermission()} and {@link #hasRequiredPermission()} instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that these methods are very similar to AccessControlled
, but creating a custom ACL
seems more laborious than implementing them as written.
What about jenkins/core/src/main/java/hudson/model/AdministrativeMonitor.java Lines 178 to 179 in dc36857
MANAGE could see monitors and agree to fix the issue the monitor warns about, but they could not dismiss monitors they found irrelevant.
|
* Checks if the current user has the minimum required permission to view this administrative monitor. | ||
* <p> | ||
* Subclasses may override this method and {@link #hasRequiredPermission()} instead of {@link #getRequiredPermission()} to perform more complex permission checks, | ||
* for example, checking either {@link Jenkins#MANAGE} or {@link Jenkins#SYSTEM_READ}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Javadoc is misleading as it implies that you could grant permission to see admin monitors based on some other criteria. But in fact due to hasPermissionToDisplay
these are really the only permissions you can check.
This allows users with
Overall/MANAGE
permission but notOverall/SYSTEM_READ
to display administrative monitors if the administrative monitor has been implemented to allow it.Testing done
Verified with a custom administrative monitor allowing
Overall/MANAGE
that it can be displayed in the corresponding UI area by a user with this permission.Proposed changelog entries
Overall/MANAGE
permissionProposed upgrade guidelines
N/A
Submitter checklist
Desired reviewers
@mention
Before the changes are marked as
ready-for-merge
:Maintainer checklist