Skip to content

Commit 8b761a0

Browse files
Fix formatting and comments in AdministrativeMonitor
1 parent 7709367 commit 8b761a0

File tree

1 file changed

+35
-65
lines changed

1 file changed

+35
-65
lines changed

core/src/main/java/hudson/model/AdministrativeMonitor.java

Lines changed: 35 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -57,42 +57,33 @@
5757
* monitoring and activate/deactivate the monitor accordingly. Sometimes
5858
* this can be done by updating a flag from code (see {@link SCMTrigger}
5959
* for one such example), while other times it's more convenient to do
60-
* so by running some code periodically (for this, use
61-
* {@link TimerTrigger#timer})
60+
* so by running some code periodically (for this, use {@link TimerTrigger#timer})
6261
*
6362
* <p>
64-
* {@link AdministrativeMonitor}s are bound to URL by
65-
* {@link Jenkins#getAdministrativeMonitor(String)}.
63+
* {@link AdministrativeMonitor}s are bound to URL by {@link Jenkins#getAdministrativeMonitor(String)}.
6664
* See {@link #getUrl()}.
6765
*
6866
* <h3>Views</h3>
6967
* <dl>
7068
* <dt>message.jelly</dt>
7169
* <dd>
72-
* If {@link #isActivated()} returns true, Jenkins will use the
73-
* {@code message.jelly}
70+
* If {@link #isActivated()} returns true, Jenkins will use the {@code message.jelly}
7471
* view of this object to render the warning text. This happens in the
7572
* {@code http://SERVER/jenkins/manage} page. This view should typically render
76-
* a DIV box with class='alert alert-danger' or class='alert alert-warning' with
77-
* a human-readable text
73+
* a DIV box with class='alert alert-danger' or class='alert alert-warning' with a human-readable text
7874
* inside it. It often also contains a link to a page that provides more details
7975
* about the problem.<br>
80-
* Additionally 2 numbers are shown in the Jenkins header of administrators, one
81-
* with the number or active
82-
* non-security relevant monitors and one with the number of active security
83-
* relevant monitors.
76+
* Additionally 2 numbers are shown in the Jenkins header of administrators, one with the number or active
77+
* non-security relevant monitors and one with the number of active security relevant monitors.
8478
* </dd>
8579
* </dl>
8680
*
8781
* <h3>Use with System Read permission</h3>
8882
* <p>
89-
* By default administrative monitors are visible only to users with Administer
90-
* permission.
91-
* Users with {@link Jenkins#SYSTEM_READ} permission can access administrative
92-
* monitors that override {@link #getRequiredPermission()}.
93-
* Care needs to be taken to ensure users with that permission don't have access
94-
* to actions modifying system state.
95-
* For more details, see {@link #getRequiredPermission()}.
83+
* By default administrative monitors are visible only to users with Administer permission.
84+
* Users with {@link Jenkins#SYSTEM_READ} permission can access administrative monitors that override {@link #getRequiredPermission()}.
85+
* Care needs to be taken to ensure users with that permission don't have access to actions modifying system state.
86+
* For more details, see {@link #getRequiredPermission()}.
9687
* </p>
9788
*
9889
* @author Kohsuke Kawaguchi
@@ -121,8 +112,7 @@ protected AdministrativeMonitor() {
121112
}
122113

123114
/**
124-
* Returns the URL of this monitor, relative to the context path, like
125-
* "administrativeMonitor/foobar".
115+
* Returns the URL of this monitor, relative to the context path, like "administrativeMonitor/foobar".
126116
*/
127117
public String getUrl() {
128118
return "administrativeMonitor/" + id;
@@ -154,12 +144,10 @@ public void disable(boolean value) throws IOException {
154144
}
155145

156146
/**
157-
* Returns true if this monitor {@link #disable(boolean) isn't disabled}
158-
* earlier.
147+
* Returns true if this monitor {@link #disable(boolean) isn't disabled} earlier.
159148
*
160149
* <p>
161-
* This flag implements the ability for the admin to say "no thank you" to the
162-
* monitor that
150+
* This flag implements the ability for the admin to say "no thank you" to the monitor that
163151
* he wants to ignore.
164152
*/
165153
public boolean isEnabled() {
@@ -302,38 +290,26 @@ public void doSnooze(StaplerRequest2 req, StaplerResponse2 rsp) throws IOExcepti
302290
}
303291
}
304292

305-
/**
293+
/**
306294
* Required permission to view this admin monitor.
307-
* By default {@link Jenkins#ADMINISTER}, but {@link Jenkins#SYSTEM_READ} or
308-
* {@link Jenkins#MANAGE} are also supported.
295+
* By default {@link Jenkins#ADMINISTER}, but {@link Jenkins#SYSTEM_READ} or {@link Jenkins#MANAGE} are also supported.
309296
* <p>
310-
* Changing this permission check to return {@link Jenkins#SYSTEM_READ} will
311-
* make the active
312-
* administrative monitor appear on {@link ManageJenkinsAction} to users without
313-
* Administer permission.
314-
* {@link #doDisable(StaplerRequest2, StaplerResponse2)} will still always
315-
* require Administer permission.
297+
* Changing this permission check to return {@link Jenkins#SYSTEM_READ} will make the active
298+
* administrative monitor appear on {@link ManageJenkinsAction} to users without Administer permission.
299+
* {@link #doDisable(StaplerRequest2, StaplerResponse2)} will still always require Administer permission.
316300
* </p>
317301
* <p>
318-
* This method only allows for a single permission to be returned. If more
319-
* complex permission checks are required,
320-
* override {@link #checkRequiredPermission()} and
321-
* {@link #hasRequiredPermission()} instead.
302+
* This method only allows for a single permission to be returned. If more complex permission checks are required,
303+
* override {@link #checkRequiredPermission()} and {@link #hasRequiredPermission()} instead.
322304
* </p>
323305
* <p>
324-
* Implementers need to ensure that {@code doAct} and other web methods perform
325-
* necessary permission checks:
326-
* Users with System Read permissions are expected to be limited to read-only
327-
* access.
328-
* Form UI elements that change system state, e.g. toggling a feature on or off,
329-
* need to be hidden from users
330-
* lacking Administer permission.
306+
* Implementers need to ensure that {@code doAct} and other web methods perform necessary permission checks:
307+
* Users with System Read permissions are expected to be limited to read-only access.
308+
* Form UI elements that change system state, e.g. toggling a feature on or off, need to be hidden from users
309+
* lacking Administer permission.
331310
* </p>
332-
*
333311
* @since 2.233
334-
* @deprecated Callers should use {@link #checkRequiredPermission()} or
335-
* {@link #hasRequiredPermission()}.
336-
*/
312+
* @deprecated Callers should use {@link #checkRequiredPermission()} or {@link #hasRequiredPermission()}.
337313
@Deprecated
338314
public Permission getRequiredPermission() {
339315
return Jenkins.ADMINISTER;
@@ -358,15 +334,11 @@ public void checkRequiredPermission() {
358334
Jenkins.get().checkPermission(getRequiredPermission());
359335
}
360336

361-
/**
362-
* Checks if the current user has the minimum required permission to view this
363-
* administrative monitor.
337+
/**
338+
* Checks if the current user has the minimum required permission to view this administrative monitor.
364339
* <p>
365-
* Subclasses may override this method and {@link #checkRequiredPermission}
366-
* instead of {@link #getRequiredPermission()} to perform more complex
367-
* permission checks,
368-
* for example, checking either {@link Jenkins#MANAGE} or
369-
* {@link Jenkins#SYSTEM_READ}.
340+
* Subclasses may override this method and {@link #hasRequiredPermission()} instead of {@link #getRequiredPermission()} to perform more complex permission checks,
341+
* for example, checking either {@link Jenkins#MANAGE} or {@link Jenkins#SYSTEM_READ}.
370342
* </p>
371343
*
372344
* @see #getRequiredPermission()
@@ -377,12 +349,11 @@ public boolean hasRequiredPermission() {
377349
return Jenkins.get().hasPermission(getRequiredPermission());
378350
}
379351

380-
/**
381-
* Checks if the current user has the minimum required permission to view any
382-
* administrative monitor.
383-
*
384-
* @return true if the current user has the minimum required permission to view
385-
* any administrative monitor.
352+
/**
353+
* Checks if the current user has the minimum required permission to view this administrative monitor.
354+
* <p>
355+
* Subclasses may override this method and {@link #checkRequiredPermission} instead of {@link #getRequiredPermission()} to perform more complex permission checks,
356+
* for example, checking either {@link Jenkins#MANAGE} or {@link Jenkins#SYSTEM_READ}.
386357
*
387358
* @since 2.468
388359
*/
@@ -391,8 +362,7 @@ public static boolean hasPermissionToDisplay() {
391362
}
392363

393364
/**
394-
* Ensure that URLs in this administrative monitor are only accessible to users
395-
* with {@link #getRequiredPermission()}.
365+
* Ensure that URLs in this administrative monitor are only accessible to users with {@link #getRequiredPermission()}.
396366
*/
397367
@Override
398368
@Restricted(NoExternalUse.class)

0 commit comments

Comments
 (0)