public ACL getACL() { return Jenkins.getInstance().getACL(); }
/** * Run arbitrary Groovy script and return result as plain text. */ public void doScriptText(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { _doScript(req, rsp, req.getView(this, "_scriptText.jelly"), FilePath.localChannel, getACL()); }
/** * For system diagnostics. * Run arbitrary Groovy script. */ public void doScript(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { _doScript(req, rsp, req.getView(this, "_script.jelly"), FilePath.localChannel, getACL()); }
/** * Checks if the current user (for which we are processing the current request) * has the admin access. * * @deprecated since 2007-12-18. * This method is deprecated when Hudson moved from simple Unix root-like model * of "admin gets to do everything, and others don't have any privilege" to more * complex {@link hudson.security.ACL} and {@link hudson.security.Permission} based scheme. * * <p> * For a quick migration, use {@code Hudson.getInstance().getACL().hasPermission(Hudson.ADMINISTER)} * To check if the user has the 'administer' role in Hudson. * * <p> * But ideally, your plugin should first identify a suitable {@link hudson.security.Permission} (or create one, * if appropriate), then identify a suitable {@link hudson.security.AccessControlled} object to check its permission * against. */ @Deprecated public static boolean isAdmin() { return Jenkins.getInstance().getACL().hasPermission(ADMINISTER); }
/** * Returns all the registered {@link TopLevelItemDescriptor}s that the specified security principal is allowed to * create within the specified item group. * * @since 1.607 */ public static List<TopLevelItemDescriptor> all(Authentication a, ItemGroup c) { List<TopLevelItemDescriptor> result = new ArrayList<TopLevelItemDescriptor>(); ACL acl; if (c instanceof AccessControlled) { acl = ((AccessControlled) c).getACL(); } else { // fall back to root acl = Jenkins.getInstance().getACL(); } for (TopLevelItemDescriptor d: all()) { if (acl.hasCreatePermission(a, c, d) && d.isApplicableIn(c)) { result.add(d); } } return result; }
private void checkPermission(Permission permission) { if (((GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class)).isUseAuthenticatedEndpoint()) { if (!Jenkins.getActiveInstance().getACL().hasPermission(authentication, permission)) { String message = Messages.AccessDeniedException2_MissingPermission(authentication.getName(), permission.group.title+"/"+permission.name); LOGGER.finest("Unauthorized (Did you forget to add API Token to the web hook ?)"); throw HttpResponses.errorWithoutStack(403, message); } } }
public ACL getACL() { // TODO switch to Jenkins.getInstance() once 2.0+ is the baseline return Jenkins.getActiveInstance().getACL(); }
public ACL getACL() { // TODO switch to Jenkins.getInstance() once 2.0+ is the baseline return Jenkins.getActiveInstance().getACL(); }
public ACL getACL() { return Jenkins.getInstance().getACL(); }
/** * For system diagnostics. * Run arbitrary Groovy script. */ public void doScript(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { _doScript(req, rsp, req.getView(this, "_script.jelly"), FilePath.localChannel, getACL()); }
/** * Run arbitrary Groovy script and return result as plain text. */ public void doScriptText(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { _doScript(req, rsp, req.getView(this, "_scriptText.jelly"), FilePath.localChannel, getACL()); }
public boolean getThemesSupported() { // Need to make sure the user at least has READ permissions, otherwise the test harness // in Jenkins core starts throwing ACL errors. If READ permissions are not available, // then don't try supporting UI Themes. Should only effect the test harness !! return Jenkins.getInstance().getACL().hasPermission(Permission.READ); } }
/** * Returns whether the current user has the permission to edit the available Groovy parsers. * * @return {@code true} if the user has the right, {@code false} otherwise */ @SuppressWarnings("unused") // Called from config.jelly public boolean canEditParsers() { return Jenkins.getInstance().getACL().hasPermission(Jenkins.RUN_SCRIPTS); }
/** * Checks if the current security principal has this permission. * * @param permission * the permission to check for * * @return {@code false} if the user doesn't have the permission */ public boolean hasPermission(final Permission permission) { return getJenkins().getACL().hasPermission(permission); }
/** * Returns whether the current user has the permission to edit the available * Groovy parsers. * * @return {@code true} if the user has the right, {@code false} otherwise */ public boolean canEditParsers() { return Jenkins.getInstance().getACL().hasPermission(Jenkins.RUN_SCRIPTS); }
private boolean canRunScripts() { return Jenkins.getInstance().getACL().hasPermission(Jenkins.RUN_SCRIPTS); }
/** * Checks if the current user (for which we are processing the current request) * has the admin access. * * @deprecated since 2007-12-18. * This method is deprecated when Hudson moved from simple Unix root-like model * of "admin gets to do everything, and others don't have any privilege" to more * complex {@link hudson.security.ACL} and {@link hudson.security.Permission} based scheme. * * <p> * For a quick migration, use {@code Hudson.getInstance().getACL().hasPermission(Hudson.ADMINISTER)} * To check if the user has the 'administer' role in Hudson. * * <p> * But ideally, your plugin should first identify a suitable {@link hudson.security.Permission} (or create one, * if appropriate), then identify a suitable {@link hudson.security.AccessControlled} object to check its permission * against. */ @Deprecated public static boolean isAdmin() { return Jenkins.getInstance().getACL().hasPermission(ADMINISTER); }
/** * Returns all the registered {@link TopLevelItemDescriptor}s that the specified security principal is allowed to * create within the specified item group. * * @since 1.607 */ public static List<TopLevelItemDescriptor> all(Authentication a, ItemGroup c) { List<TopLevelItemDescriptor> result = new ArrayList<TopLevelItemDescriptor>(); ACL acl; if (c instanceof AccessControlled) { acl = ((AccessControlled) c).getACL(); } else { // fall back to root acl = Jenkins.getInstance().getACL(); } for (TopLevelItemDescriptor d: all()) { if (acl.hasCreatePermission(a, c, d) && d.isApplicableIn(c)) { result.add(d); } } return result; }
public StandardListBoxModel doFillDefaultValueItems(@AncestorInPath Item context, @QueryParameter(required = true) String credentialType) { // TODO switch to Jenkins.getInstance() once 2.0+ is the baseline Jenkins jenkins = Jenkins.getActiveInstance(); final ACL acl = context == null ? jenkins.getACL() : context.getACL(); final Class<? extends StandardCredentials> typeClass = decodeType(credentialType); final List<DomainRequirement> domainRequirements = Collections.<DomainRequirement>emptyList(); final StandardListBoxModel result = new StandardListBoxModel(); result.includeEmptyValue(); if (acl.hasPermission(CredentialsProvider.USE_ITEM)) { result.includeAs(CredentialsProvider.getDefaultAuthenticationOf(context), context, typeClass, domainRequirements); } return result; }
public StandardListBoxModel doFillDefaultValueItems(@AncestorInPath Item context, @QueryParameter(required = true) String credentialType) { // TODO switch to Jenkins.getInstance() once 2.0+ is the baseline Jenkins jenkins = Jenkins.getActiveInstance(); final ACL acl = context == null ? jenkins.getACL() : context.getACL(); final Class<? extends StandardCredentials> typeClass = decodeType(credentialType); final List<DomainRequirement> domainRequirements = Collections.<DomainRequirement>emptyList(); final StandardListBoxModel result = new StandardListBoxModel(); result.includeEmptyValue(); if (acl.hasPermission(CredentialsProvider.USE_ITEM)) { result.includeAs(CredentialsProvider.getDefaultAuthenticationOf(context), context, typeClass, domainRequirements); } return result; }