[JENKINS-66470] Register view-related permission groups and permissions prior to the execution of JCasC (#5723)

* [JENKINS-66470] Register view-related permission groups and permissions prior to the execution of JCasC

* Update core/src/main/java/hudson/model/View.java

Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>

Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
This commit is contained in:
Basil CrowandDaniel Beck authored and GitHub committed 2021-09-16 16:43:11 +01:00
1 parent ca0508eaa9
commit 2cf5a80da0
1 file changed
+12
+12
View File
@@ -32,6 +32,8 @@ import hudson.ExtensionPoint;
import hudson.Functions;
import hudson.Indenter;
import hudson.Util;
import hudson.init.InitMilestone;
import hudson.init.Initializer;
import hudson.model.Descriptor.FormException;
import hudson.model.listeners.ItemListener;
import hudson.scm.ChangeLogSet;
@@ -1318,6 +1320,16 @@ public abstract class View extends AbstractModelObject implements AccessControll
public static final Permission CONFIGURE = new Permission(PERMISSIONS,"Configure", Messages._View_ConfigurePermission_Description(), Permission.CONFIGURE, PermissionScope.ITEM_GROUP);
public static final Permission READ = new Permission(PERMISSIONS,"Read", Messages._View_ReadPermission_Description(), Permission.READ, PermissionScope.ITEM_GROUP);
@Initializer(before = InitMilestone.SYSTEM_CONFIG_LOADED)
@Restricted(DoNotUse.class)
public static void registerPermissions() {
// Pending JENKINS-17200, ensure that the above permissions have been registered prior to
// allowing plugins to adapt the system configuration, which may depend on these permissions
// having been registered. Since this method is static and since it follows the above
// construction of static permission objects (and therefore their calls to
// PermissionGroup#register), there is nothing further to do in this method.
}
// to simplify access from Jelly
public static Permission getItemCreatePermission() {
return Item.CREATE;