public static VistaUserMap addUsersFromProperties(VistaUserMap userMap, Properties props) {
// Now we have properties, process each one individually
UserAttributeEditor configAttribEd = new UserAttributeEditor();
for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
String key = (String) iter.next();
String value = props.getProperty(key);
// Convert value to a password, enabled setting, and list of granted authorities
configAttribEd.setAsText(value);
UserAttribute attr = (UserAttribute) configAttribEd.getValue();
// Make a user object, assuming the properties were properly provided
if (attr != null) {
String duz = StringUtils.split(key, "@")[0];
String stationNumber = StringUtils.split(key, "@")[1];
String access = StringUtils.split(attr.getPassword(), ";")[0];
String verify = StringUtils.split(attr.getPassword(), ";")[1];
VistaUserDetails user = new VistaUser(new RpcHost("localhost"), new Random().toString(), stationNumber, stationNumber, duz, verify, "foobar", attr.isEnabled(), true, true, true, attr.getAuthorities());
userMap.addUser(user);
}
}
return userMap;
}
VistaUserMapEditor.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:eHMP
作者:
评论列表
文章目录