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


Java User.getProperty方法代码示例

本文整理汇总了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));
    }
}
 
开发者ID:inFullMobile,项目名称:restricted-register-plugin,代码行数:25,代码来源:ActivationCodeFormValidator.java

示例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());
}
 
开发者ID:ElevenPaths,项目名称:latch-plugin-jenkins,代码行数:23,代码来源:LatchAccountProperty.java

示例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();
}
 
开发者ID:samsta,项目名称:quarantine,代码行数:21,代码来源:MailNotifier.java

示例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;
}
 
开发者ID:inFullMobile,项目名称:restricted-register-plugin,代码行数:12,代码来源:RRHudsonUserProperty.java

示例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);
}
 
开发者ID:inFullMobile,项目名称:restricted-register-plugin,代码行数:8,代码来源:RRHudsonUserProperty.java

示例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;
}
 
开发者ID:ElevenPaths,项目名称:latch-plugin-jenkins,代码行数:10,代码来源:LatchSecurityListener.java

示例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;
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:12,代码来源:P4AddressResolver.java

示例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();
}
 
开发者ID:inFullMobile,项目名称:restricted-register-plugin,代码行数:5,代码来源:RRHudsonUserProperty.java

示例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);
}
 
开发者ID:inFullMobile,项目名称:restricted-register-plugin,代码行数:7,代码来源:RRHudsonUserProperty.java

示例10: getUserPreferredProviderProperty

import hudson.model.User; //导入方法依赖的package包/类
@VisibleForTesting
protected PreferredProviderUserProperty getUserPreferredProviderProperty() {
    User user = User.current();
    return (user == null) ? null : user.getProperty(PreferredProviderUserProperty.class);
}
 
开发者ID:jenkinsci,项目名称:display-url-api-plugin,代码行数:6,代码来源:AbstractDisplayAction.java


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