本文整理汇总了Java中hudson.model.User.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java User.getProperty方法的具体用法?Java User.getProperty怎么用?Java User.getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.User
的用法示例。
在下文中一共展示了User.getProperty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyFormData
import hudson.model.User; //导入方法依赖的package包/类
@Override
public void verifyFormData(HudsonSecurityRealmRegistration securityRealmRegistration, JSONObject object)
throws RegistrationException, InvalidSecurityRealmException {
final String activationCode = BaseFormField.ACTIVATION_CODE.fromJSON(object);
if (StringUtils.isEmpty(activationCode)) {
throw new RegistrationException(Messages.RRError_Hudson_ActiviationCodeInvalid());
}
final User user = RRHudsonUserProperty.getUserForActivationCode(activationCode);
final RRHudsonUserProperty hudsonUserProperty = RRHudsonUserProperty.getPropertyForUser(user);
if (hudsonUserProperty == null) {
throw new RegistrationException(Messages.RRError_Hudson_ActiviationCodeInvalid());
}
if (hudsonUserProperty.getActivated()) {
throw new RegistrationException(Messages.RRError_Hudson_UserIsActivated());
}
final Mailer.UserProperty mailerProperty = user.getProperty(Mailer.UserProperty.class);
if (mailerProperty == null) {
throw new RegistrationException(Messages.RRError_Hudson_UserNoEmailAddress());
}
final String emailAddress = Utils.fixEmptyString(mailerProperty.getAddress());
if (!EmailValidator.getInstance().isValid(emailAddress)) {
throw new RegistrationException(Messages.RRError_Hudson_UserInvalidEmail(emailAddress));
}
}
示例2: doLatchUnpairConnection
import hudson.model.User; //导入方法依赖的package包/类
public FormValidation doLatchUnpairConnection(@AncestorInPath User user,
@QueryParameter("csrf") final String csrf) throws IOException {
if (validCSRF(csrf)) {
LatchAccountProperty lap = user.getProperty(LatchAccountProperty.class);
LatchApp latchApp = LatchSDK.getInstance();
if (latchApp != null) {
LatchResponse unpairResponse = latchApp.unpair(lap.getAccountId());
if (unpairResponse == null) {
return FormValidation.error(Messages.LatchAccountProperty_UnreachableConnection());
} else if (unpairResponse.getError() != null && unpairResponse.getError().getCode() != 201) {
return FormValidation.error(unpairResponse.getError().getMessage());
} else {
lap.accountId = null;
lap.user.save();
return FormValidation.ok(Messages.LatchAccountProperty_Unpair());
}
}
return FormValidation.ok(Messages.LatchAccountProperty_PluginDisabled());
}
return FormValidation.error(Messages.LatchAccountProperty_Csrf());
}
示例3: getEmailAddress
import hudson.model.User; //导入方法依赖的package包/类
public String getEmailAddress(String username) {
String address = null;
User u = User.get(username);
if (u == null) {
println("failed obtaining user for name " + username);
return address;
}
Mailer.UserProperty p = u.getProperty(Mailer.UserProperty.class);
if (p == null) {
println("failed obtaining email address for user " + username);
return address;
}
if (p.getAddress() == null) {
println("failed obtaining email address (is null) for user " + username);
return address;
}
return p.getAddress();
}
示例4: getUserForCode
import hudson.model.User; //导入方法依赖的package包/类
@Nullable
private static User getUserForCode(@Nonnull String activationCode) {
final List<User> allUsers = new ArrayList<>(User.getAll());
for (User user : allUsers) {
final RRHudsonUserProperty userProperty = user.getProperty(RRHudsonUserProperty.class);
if (userProperty != null && activationCode.equals(userProperty.getActivationCode())) {
return user;
}
}
return null;
}
示例5: getPropertyForUser
import hudson.model.User; //导入方法依赖的package包/类
@Nullable
public static RRHudsonUserProperty getPropertyForUser(@Nullable User user) {
if (user == null) {
return null;
}
return user.getProperty(RRHudsonUserProperty.class);
}
示例6: checkLatch
import hudson.model.User; //导入方法依赖的package包/类
private static boolean checkLatch(UserDetails userDetails){
boolean result = true;
User user = Jenkins.getInstance().getUser(userDetails.getUsername());
LatchAccountProperty latchUserProperties = (user != null) ? user.getProperty(LatchAccountProperty.class) : null;
if (latchUserProperties != null && latchUserProperties.getAccountId() != null) {
result = AsyncLatchHandler.checkLatchUnlockedStatus(LatchSDK.getInstance(), latchUserProperties.getAccountId());
}
return result;
}
示例7: findMailAddressFor
import hudson.model.User; //导入方法依赖的package包/类
@Override
public String findMailAddressFor(User user) {
P4UserProperty prop = user.getProperty(P4UserProperty.class);
if (prop != null) {
String id = user.getId();
String email = prop.getEmail();
logger.fine("MailAddressResolver: " + id + ":" + email);
return email;
}
return null;
}
示例8: isUserActivated
import hudson.model.User; //导入方法依赖的package包/类
public static boolean isUserActivated(@Nonnull User user) {
final RRHudsonUserProperty userProperty = user.getProperty(RRHudsonUserProperty.class);
return userProperty != null && userProperty.getActivated();
}
示例9: 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);
}
示例10: getUserPreferredProviderProperty
import hudson.model.User; //导入方法依赖的package包/类
@VisibleForTesting
protected PreferredProviderUserProperty getUserPreferredProviderProperty() {
User user = User.current();
return (user == null) ? null : user.getProperty(PreferredProviderUserProperty.class);
}