jenkins.model.Jenkins.getACL()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中jenkins.model.Jenkins.getACL()方法的一些代码示例,展示了Jenkins.getACL()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getACL()方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getACL

Jenkins.getACL介绍

[英]Returns the root ACL.
[中]返回根ACL。

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. public ACL getACL() {
  2. return Jenkins.getInstance().getACL();
  3. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Run arbitrary Groovy script and return result as plain text.
  3. */
  4. public void doScriptText(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  5. _doScript(req, rsp, req.getView(this, "_scriptText.jelly"), FilePath.localChannel, getACL());
  6. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * For system diagnostics.
  3. * Run arbitrary Groovy script.
  4. */
  5. public void doScript(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  6. _doScript(req, rsp, req.getView(this, "_script.jelly"), FilePath.localChannel, getACL());
  7. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Checks if the current user (for which we are processing the current request)
  3. * has the admin access.
  4. *
  5. * @deprecated since 2007-12-18.
  6. * This method is deprecated when Hudson moved from simple Unix root-like model
  7. * of "admin gets to do everything, and others don't have any privilege" to more
  8. * complex {@link hudson.security.ACL} and {@link hudson.security.Permission} based scheme.
  9. *
  10. * <p>
  11. * For a quick migration, use {@code Hudson.getInstance().getACL().hasPermission(Hudson.ADMINISTER)}
  12. * To check if the user has the 'administer' role in Hudson.
  13. *
  14. * <p>
  15. * But ideally, your plugin should first identify a suitable {@link hudson.security.Permission} (or create one,
  16. * if appropriate), then identify a suitable {@link hudson.security.AccessControlled} object to check its permission
  17. * against.
  18. */
  19. @Deprecated
  20. public static boolean isAdmin() {
  21. return Jenkins.getInstance().getACL().hasPermission(ADMINISTER);
  22. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Returns all the registered {@link TopLevelItemDescriptor}s that the specified security principal is allowed to
  3. * create within the specified item group.
  4. *
  5. * @since 1.607
  6. */
  7. public static List<TopLevelItemDescriptor> all(Authentication a, ItemGroup c) {
  8. List<TopLevelItemDescriptor> result = new ArrayList<TopLevelItemDescriptor>();
  9. ACL acl;
  10. if (c instanceof AccessControlled) {
  11. acl = ((AccessControlled) c).getACL();
  12. } else {
  13. // fall back to root
  14. acl = Jenkins.getInstance().getACL();
  15. }
  16. for (TopLevelItemDescriptor d: all()) {
  17. if (acl.hasCreatePermission(a, c, d) && d.isApplicableIn(c)) {
  18. result.add(d);
  19. }
  20. }
  21. return result;
  22. }

代码示例来源:origin: jenkinsci/gitlab-plugin

  1. private void checkPermission(Permission permission) {
  2. if (((GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class)).isUseAuthenticatedEndpoint()) {
  3. if (!Jenkins.getActiveInstance().getACL().hasPermission(authentication, permission)) {
  4. String message = Messages.AccessDeniedException2_MissingPermission(authentication.getName(), permission.group.title+"/"+permission.name);
  5. LOGGER.finest("Unauthorized (Did you forget to add API Token to the web hook ?)");
  6. throw HttpResponses.errorWithoutStack(403, message);
  7. }
  8. }
  9. }

代码示例来源:origin: org.jenkins-ci.plugins/credentials

  1. public ACL getACL() {
  2. // TODO switch to Jenkins.getInstance() once 2.0+ is the baseline
  3. return Jenkins.getActiveInstance().getACL();
  4. }

代码示例来源:origin: jenkinsci/credentials-plugin

  1. public ACL getACL() {
  2. // TODO switch to Jenkins.getInstance() once 2.0+ is the baseline
  3. return Jenkins.getActiveInstance().getACL();
  4. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. public ACL getACL() {
  2. return Jenkins.getInstance().getACL();
  3. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * For system diagnostics.
  3. * Run arbitrary Groovy script.
  4. */
  5. public void doScript(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  6. _doScript(req, rsp, req.getView(this, "_script.jelly"), FilePath.localChannel, getACL());
  7. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * Run arbitrary Groovy script and return result as plain text.
  3. */
  4. public void doScriptText(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  5. _doScript(req, rsp, req.getView(this, "_scriptText.jelly"), FilePath.localChannel, getACL());
  6. }

代码示例来源:origin: org.jenkins-ci.plugins.uithemes/uithemes-processor

  1. public boolean getThemesSupported() {
  2. // Need to make sure the user at least has READ permissions, otherwise the test harness
  3. // in Jenkins core starts throwing ACL errors. If READ permissions are not available,
  4. // then don't try supporting UI Themes. Should only effect the test harness !!
  5. return Jenkins.getInstance().getACL().hasPermission(Permission.READ);
  6. }
  7. }

代码示例来源:origin: jenkinsci/warnings-ng-plugin

  1. /**
  2. * Returns whether the current user has the permission to edit the available Groovy parsers.
  3. *
  4. * @return {@code true} if the user has the right, {@code false} otherwise
  5. */
  6. @SuppressWarnings("unused") // Called from config.jelly
  7. public boolean canEditParsers() {
  8. return Jenkins.getInstance().getACL().hasPermission(Jenkins.RUN_SCRIPTS);
  9. }

代码示例来源:origin: jenkinsci/warnings-ng-plugin

  1. /**
  2. * Checks if the current security principal has this permission.
  3. *
  4. * @param permission
  5. * the permission to check for
  6. *
  7. * @return {@code false} if the user doesn't have the permission
  8. */
  9. public boolean hasPermission(final Permission permission) {
  10. return getJenkins().getACL().hasPermission(permission);
  11. }

代码示例来源:origin: jenkinsci/warnings-plugin

  1. /**
  2. * Returns whether the current user has the permission to edit the available
  3. * Groovy parsers.
  4. *
  5. * @return {@code true} if the user has the right, {@code false} otherwise
  6. */
  7. public boolean canEditParsers() {
  8. return Jenkins.getInstance().getACL().hasPermission(Jenkins.RUN_SCRIPTS);
  9. }

代码示例来源:origin: jenkinsci/warnings-plugin

  1. private boolean canRunScripts() {
  2. return Jenkins.getInstance().getACL().hasPermission(Jenkins.RUN_SCRIPTS);
  3. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * Checks if the current user (for which we are processing the current request)
  3. * has the admin access.
  4. *
  5. * @deprecated since 2007-12-18.
  6. * This method is deprecated when Hudson moved from simple Unix root-like model
  7. * of "admin gets to do everything, and others don't have any privilege" to more
  8. * complex {@link hudson.security.ACL} and {@link hudson.security.Permission} based scheme.
  9. *
  10. * <p>
  11. * For a quick migration, use {@code Hudson.getInstance().getACL().hasPermission(Hudson.ADMINISTER)}
  12. * To check if the user has the 'administer' role in Hudson.
  13. *
  14. * <p>
  15. * But ideally, your plugin should first identify a suitable {@link hudson.security.Permission} (or create one,
  16. * if appropriate), then identify a suitable {@link hudson.security.AccessControlled} object to check its permission
  17. * against.
  18. */
  19. @Deprecated
  20. public static boolean isAdmin() {
  21. return Jenkins.getInstance().getACL().hasPermission(ADMINISTER);
  22. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * Returns all the registered {@link TopLevelItemDescriptor}s that the specified security principal is allowed to
  3. * create within the specified item group.
  4. *
  5. * @since 1.607
  6. */
  7. public static List<TopLevelItemDescriptor> all(Authentication a, ItemGroup c) {
  8. List<TopLevelItemDescriptor> result = new ArrayList<TopLevelItemDescriptor>();
  9. ACL acl;
  10. if (c instanceof AccessControlled) {
  11. acl = ((AccessControlled) c).getACL();
  12. } else {
  13. // fall back to root
  14. acl = Jenkins.getInstance().getACL();
  15. }
  16. for (TopLevelItemDescriptor d: all()) {
  17. if (acl.hasCreatePermission(a, c, d) && d.isApplicableIn(c)) {
  18. result.add(d);
  19. }
  20. }
  21. return result;
  22. }

代码示例来源:origin: org.jenkins-ci.plugins/credentials

  1. public StandardListBoxModel doFillDefaultValueItems(@AncestorInPath Item context,
  2. @QueryParameter(required = true) String credentialType) {
  3. // TODO switch to Jenkins.getInstance() once 2.0+ is the baseline
  4. Jenkins jenkins = Jenkins.getActiveInstance();
  5. final ACL acl = context == null ? jenkins.getACL() : context.getACL();
  6. final Class<? extends StandardCredentials> typeClass = decodeType(credentialType);
  7. final List<DomainRequirement> domainRequirements = Collections.<DomainRequirement>emptyList();
  8. final StandardListBoxModel result = new StandardListBoxModel();
  9. result.includeEmptyValue();
  10. if (acl.hasPermission(CredentialsProvider.USE_ITEM)) {
  11. result.includeAs(CredentialsProvider.getDefaultAuthenticationOf(context), context, typeClass, domainRequirements);
  12. }
  13. return result;
  14. }

代码示例来源:origin: jenkinsci/credentials-plugin

  1. public StandardListBoxModel doFillDefaultValueItems(@AncestorInPath Item context,
  2. @QueryParameter(required = true) String credentialType) {
  3. // TODO switch to Jenkins.getInstance() once 2.0+ is the baseline
  4. Jenkins jenkins = Jenkins.getActiveInstance();
  5. final ACL acl = context == null ? jenkins.getACL() : context.getACL();
  6. final Class<? extends StandardCredentials> typeClass = decodeType(credentialType);
  7. final List<DomainRequirement> domainRequirements = Collections.<DomainRequirement>emptyList();
  8. final StandardListBoxModel result = new StandardListBoxModel();
  9. result.includeEmptyValue();
  10. if (acl.hasPermission(CredentialsProvider.USE_ITEM)) {
  11. result.includeAs(CredentialsProvider.getDefaultAuthenticationOf(context), context, typeClass, domainRequirements);
  12. }
  13. return result;
  14. }

相关文章

Jenkins类方法