本文整理了Java中jenkins.model.Jenkins.getACL()
方法的一些代码示例,展示了Jenkins.getACL()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getACL()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getACL
[英]Returns the root ACL.
[中]返回根ACL。
代码示例来源:origin: jenkinsci/jenkins
public ACL getACL() {
return Jenkins.getInstance().getACL();
}
代码示例来源:origin: jenkinsci/jenkins
/**
* 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());
}
代码示例来源:origin: jenkinsci/jenkins
/**
* 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());
}
代码示例来源:origin: jenkinsci/jenkins
/**
* 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);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* 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;
}
代码示例来源:origin: jenkinsci/gitlab-plugin
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);
}
}
}
代码示例来源:origin: org.jenkins-ci.plugins/credentials
public ACL getACL() {
// TODO switch to Jenkins.getInstance() once 2.0+ is the baseline
return Jenkins.getActiveInstance().getACL();
}
代码示例来源:origin: jenkinsci/credentials-plugin
public ACL getACL() {
// TODO switch to Jenkins.getInstance() once 2.0+ is the baseline
return Jenkins.getActiveInstance().getACL();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public ACL getACL() {
return Jenkins.getInstance().getACL();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* 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());
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* 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());
}
代码示例来源:origin: org.jenkins-ci.plugins.uithemes/uithemes-processor
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);
}
}
代码示例来源:origin: jenkinsci/warnings-ng-plugin
/**
* 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);
}
代码示例来源:origin: jenkinsci/warnings-ng-plugin
/**
* 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);
}
代码示例来源:origin: jenkinsci/warnings-plugin
/**
* 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);
}
代码示例来源:origin: jenkinsci/warnings-plugin
private boolean canRunScripts() {
return Jenkins.getInstance().getACL().hasPermission(Jenkins.RUN_SCRIPTS);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* 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);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* 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;
}
代码示例来源:origin: org.jenkins-ci.plugins/credentials
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;
}
代码示例来源:origin: jenkinsci/credentials-plugin
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;
}
内容来源于网络,如有侵权,请联系作者删除!