当前位置: 首页>>代码示例>>Java>>正文


Java User.addProperty方法代码示例

本文整理汇总了Java中hudson.model.User.addProperty方法的典型用法代码示例。如果您正苦于以下问题:Java User.addProperty方法的具体用法?Java User.addProperty怎么用?Java User.addProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hudson.model.User的用法示例。


在下文中一共展示了User.addProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doLatchPairConnection

import hudson.model.User; //导入方法依赖的package包/类
public FormValidation doLatchPairConnection(@QueryParameter("pairToken") final String pairToken,
                                            @AncestorInPath User user,
                                            @QueryParameter("csrf") final String csrf) throws IOException {
    if (validCSRF(csrf)) {
        if (pairToken != null && !pairToken.isEmpty()) {
            LatchApp latchApp = LatchSDK.getInstance();
            if (latchApp != null) {
                LatchResponse pairResponse = latchApp.pair(pairToken);

                if (pairResponse == null) {
                    return FormValidation.error(Messages.LatchAccountProperty_UnreachableConnection());
                } else if (pairResponse.getError() != null && pairResponse.getError().getCode() != 205) {
                    return FormValidation.error(Messages.LatchAccountProperty_Invalid_Token());
                } else {
                    LatchAccountProperty lap = newInstance(user);
                    lap.accountId = pairResponse.getData().get("accountId").getAsString();
                    user.addProperty(lap);
                    return FormValidation.ok(Messages.LatchAccountProperty_Pair());
                }
            }
            return FormValidation.ok(Messages.LatchAccountProperty_PluginDisabled());
        }
        return FormValidation.error(Messages.LatchAccountProperty_Invalid_Token());
    }
    return FormValidation.error(Messages.LatchAccountProperty_Csrf());
}
 
开发者ID:ElevenPaths,项目名称:latch-plugin-jenkins,代码行数:27,代码来源:LatchAccountProperty.java

示例2: getAuthor

import hudson.model.User; //导入方法依赖的package包/类
/**
 * Gets the user who made this change.
 * 
 * This is a mandatory part of the Change Log Architecture
 * 
 * @return the author of the checkin (aka commit)
 */
@Exported
public User getAuthor() {
    User user = User.get(author, false);

    if (user == null) {
        user = User.get(author, true);

        // set email address for user
        if (fixEmpty(authorEmail) != null) {
            try {
                user.addProperty(new Mailer.UserProperty(authorEmail));
            } catch (IOException e) {
                // ignore error
            }
        }
    }

    return user;
}
 
开发者ID:rjperrella,项目名称:jenkins-fossil-adapter,代码行数:27,代码来源:FossilChangeLogEntry.java

示例3: TestGitRepo

import hudson.model.User; //导入方法依赖的package包/类
public TestGitRepo(String name, File tmpDir, TaskListener listener) throws IOException, InterruptedException {
  this.name = name;
  this.listener = listener;

  envVars = new EnvVars();

  gitDir = tmpDir;
  User john = User.get(johnDoe.getName(), true);
  UserProperty johnsMailerProperty = new Mailer.UserProperty(johnDoe.getEmailAddress());
  john.addProperty(johnsMailerProperty);

  User jane = User.get(janeDoe.getName(), true);
  UserProperty janesMailerProperty = new Mailer.UserProperty(janeDoe.getEmailAddress());
  jane.addProperty(janesMailerProperty);

  // initialize the git interface.
  gitDirPath = new FilePath(gitDir);
  git = Git.with(listener, envVars).in(gitDir).getClient();

  // finally: initialize the repo
  git.init();
}
 
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:23,代码来源:TestGitRepo.java

示例4: setUp

import hudson.model.User; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
   super.setUp();
   java.util.logging.Logger.getLogger("com.gargoylesoftware.htmlunit").setLevel(java.util.logging.Level.SEVERE);

   project = createFreeStyleProject(projectName);
   DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> publishers = new DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>>(
         project);
   publishers.add(new QuarantineTestDataPublisher());
   QuarantinableJUnitResultArchiver archiver = new QuarantinableJUnitResultArchiver("*.xml");
   archiver.setTestDataPublishers(publishers);
   project.getPublishersList().add(archiver);

   hudson.setAuthorizationStrategy(new FullControlOnceLoggedInAuthorizationStrategy());
   hudson.setSecurityRealm(createDummySecurityRealm());

   User u = User.get("user1");
   u.addProperty(new Mailer.UserProperty(user1Mail));
}
 
开发者ID:samsta,项目名称:quarantine,代码行数:20,代码来源:QuarantineCoreTest.java

示例5: doFinishLogin

import hudson.model.User; //导入方法依赖的package包/类
/**
 * This is where the user comes back to at the end of the OpenID redirect
 * ping-pong.
 * 
 * @throws HttpFailure
 * @throws VerificationException
 */
public HttpResponse doFinishLogin(StaplerRequest request) {

	String redirect = redirectUrl(request);

	try {

		AccessTokenResponse tokenResponse = ServerRequest.invokeAccessCodeToToken(getKeycloakDeployment(),
				request.getParameter("code"), redirect, null);

		String tokenString = tokenResponse.getToken();
		String idTokenString = tokenResponse.getIdToken();
		String refreashToken = tokenResponse.getRefreshToken();

		AccessToken token = AdapterRSATokenVerifier.verifyToken(tokenString, getKeycloakDeployment());
		if (idTokenString != null) {
			JWSInput input = new JWSInput(idTokenString);

			IDToken idToken = input.readJsonContent(IDToken.class);
			SecurityContextHolder.getContext()
					.setAuthentication(new KeycloakAuthentication(idToken, token, refreashToken));

			User currentUser = User.current();
			if (currentUser != null) {
				currentUser.setFullName(idToken.getPreferredUsername());

				if (!currentUser.getProperty(Mailer.UserProperty.class).hasExplicitlyConfiguredAddress()) {
					currentUser.addProperty(new Mailer.UserProperty(idToken.getEmail()));
				}
			}
		}

	} catch (Exception e) {
		LOGGER.log(Level.SEVERE, "Authentication Exception ", e);
	}

	String referer = (String) request.getSession().getAttribute(REFERER_ATTRIBUTE);
	if (referer != null) {
		return HttpResponses.redirectTo(referer);
	}
	return HttpResponses.redirectToContextRoot();
}
 
开发者ID:devlauer,项目名称:jenkins-keycloak-plugin,代码行数:49,代码来源:KeycloakSecurityRealm.java

示例6: setUserActivated

import hudson.model.User; //导入方法依赖的package包/类
public static void setUserActivated(@Nonnull User user) throws IOException {
    final RRHudsonUserProperty userProperty = user.getProperty(RRHudsonUserProperty.class);
    userProperty.setActivated(true);
    userProperty.setActivatedAt(Utils.getFormattedTimestamp(new Date()));
    user.addProperty(userProperty);
}
 
开发者ID:inFullMobile,项目名称:restricted-register-plugin,代码行数:7,代码来源:RRHudsonUserProperty.java


注:本文中的hudson.model.User.addProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。