本文整理汇总了Java中gov.nih.nci.security.authorization.domainobjects.User类的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于gov.nih.nci.security.authorization.domainobjects包,在下文中一共展示了User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handleNewSample
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
private static void handleNewSample(Sample s, Project p) throws CSTransactionException, CSObjectNotFoundException {
final ProtectionGroup pg = getProtectionGroup(s);
final User csmUser = CaArrayUsernameHolder.getCsmUser();
for (final User u : p.getOwners()) {
if (!u.equals(csmUser)) {
addOwner(pg, u);
}
}
final Role readRole = getRoleByName(READ_ROLE);
final Role writeRole = getRoleByName(WRITE_ROLE);
for (final AccessProfile ap : p.getAllAccessProfiles()) {
final Group targetGroup = getTargetGroup(ap);
if (targetGroup == null) {
continue;
}
final SampleSecurityLevel sampleSecLevel = getSampleSecurityLevel(ap, s);
handleSampleSecurity(targetGroup, pg, sampleSecLevel, readRole, writeRole);
}
}
开发者ID:NCIP,项目名称:caarray,代码行数:22,代码来源:SecurityUtils.java
示例2: testAddUserKeepsAnonUserInAnonGroup
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
/**
* @see http://gforge.nci.nih.gov/tracker/index.php?func=detail&aid=12306
*/
@Test
public void testAddUserKeepsAnonUserInAnonGroup() throws CSTransactionException, CSObjectNotFoundException {
final Predicate anonUserExists = new Predicate() {
@Override
public boolean evaluate(Object o) {
return ((User) o).getLoginName().equals(SecurityUtils.ANONYMOUS_USERNAME);
}
};
final Group g =
(Group) hibernateHelper.getCurrentSession().load(Group.class,
SecurityUtils.findGroupByName(SecurityUtils.ANONYMOUS_GROUP).getGroupId());
assertTrue(CollectionUtils.exists(g.getUsers(), anonUserExists));
this.permissionsManagementService.addUsers(SecurityUtils.ANONYMOUS_GROUP, "biostatistician");
hibernateHelper.getCurrentSession().refresh(g);
assertTrue(CollectionUtils.exists(g.getUsers(), anonUserExists));
}
开发者ID:NCIP,项目名称:caarray,代码行数:20,代码来源:PermissionsManagementServiceTest.java
示例3: testCancelJobForWithDifferentOwner
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
@Test
public void testCancelJobForWithDifferentOwner() {
// setup data for system under test.
setupDataForSystemUnderTest();
// Assert that the number of jobs in the snapshot list equals number of queued jobs.
List<Job> snapshotList = systemUnderTest.getJobsForUser(mock(User.class));
assertEquals(5, snapshotList.size());
// Get the UUID and owner of a job to cancel.
Job originalJob = snapshotList.get(2);
assertFalse(originalJob.getJobStatus().equals(JobStatus.RUNNING));
UUID jobIdToCancel = originalJob.getJobId();
User user = mock(User.class);
when(user.getLoginName()).thenReturn("username");
systemUnderTest.cancelJob(jobIdToCancel.toString(), user);
// Assert that the count of queued jobs is same as before.
snapshotList = systemUnderTest.getJobsForUser(mock(User.class));
assertEquals(5, snapshotList.size());
assertEquals(snapshotList.size(), systemUnderTest.getLength());
assertEquals(snapshotList.size(), systemUnderTest.getJobList().size());
}
开发者ID:NCIP,项目名称:caarray,代码行数:25,代码来源:JobQueueTest.java
示例4: AssertEqualsForUsers
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
private void AssertEqualsForUsers (int iteration, User tempUser)
{
long tempLong;
tempLong = iteration + 2;
//Assertions to check for proper data
assertEquals("\nIncorrect Login Name\n", UserStringArray[iteration][0], tempUser.getLoginName());
assertEquals("\nIncorrect First Name\n", UserStringArray[iteration][1], tempUser.getFirstName());
assertEquals("\nIncorrect Last Name\n", UserStringArray[iteration][2], tempUser.getLastName());
assertEquals("\nIncorrect Department\n", UserStringArray[iteration][3], tempUser.getDepartment());
assertEquals("\nIncorrect EmailId\n", UserStringArray[iteration][4], tempUser.getEmailId());
assertEquals("\nIncorrect Organization Name\n", UserStringArray[iteration][5], tempUser.getOrganization());
assertEquals("\nIncorrect Password\n", UserStringArray[iteration][6], tempUser.getPassword());
assertEquals("\nIncorrect Title\n", UserStringArray[iteration][7], tempUser.getTitle());
assertEquals("\nIncorrect Phone Number\n", UserStringArray[iteration][8], tempUser.getPhoneNumber());
assertEquals("\nIncorrect User ID\n", tempLong , ((Long)tempUser.getUserId()).longValue());
}
开发者ID:NCIP,项目名称:cagrid-general,代码行数:17,代码来源:UserProvisioningManagerTest.java
示例5: hasPrivilege
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
@SuppressWarnings("PMD.EmptyCatchBlock")
private static boolean hasPrivilege(Protectable p, User user, String privilege) {
// if the protectable is not yet saved, assume user only has access if he is the current user
if (p.getId() == null) {
return CaArrayUsernameHolder.getCsmUser().equals(user);
}
try {
final Application app = getApplication();
return AuthorizationManagerExtensions.checkPermission(user.getLoginName(), getUnderlyingEntityClass(p)
.getName(), "id", p.getId().toString(), privilege, app);
} catch (final CSException e) {
LOG.warn(String.format(
"Could not check if User %s had privilege %s for protectable of class %s with id %s",
user.getLoginName(), privilege, p.getClass().getName(), p.getId()));
return false;
}
}
开发者ID:NCIP,项目名称:caarray,代码行数:18,代码来源:SecurityUtils.java
示例6: AssertEqualsForUsers
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
private void AssertEqualsForUsers(int iteration, User tempUser)
{
long tempLong;
tempLong = iteration + 1;
// Assertions to check for proper data
assertEquals("\nIncorrect Login Name\n", UserStringArray[iteration][0], tempUser.getLoginName());
assertEquals("\nIncorrect First Name\n", UserStringArray[iteration][1], tempUser.getFirstName());
assertEquals("\nIncorrect Last Name\n", UserStringArray[iteration][2], tempUser.getLastName());
assertEquals("\nIncorrect Department\n", UserStringArray[iteration][3], tempUser.getDepartment());
assertEquals("\nIncorrect EmailId\n", UserStringArray[iteration][4], tempUser.getEmailId());
assertEquals("\nIncorrect Organization Name\n", UserStringArray[iteration][5], tempUser.getOrganization());
assertEquals("\nIncorrect Password\n", UserStringArray[iteration][6], tempUser.getPassword());
assertEquals("\nIncorrect Title\n", UserStringArray[iteration][7], tempUser.getTitle());
assertEquals("\nIncorrect Phone Number\n", UserStringArray[iteration][8], tempUser.getPhoneNumber());
assertEquals("\nIncorrect User ID\n", tempLong, ((Long) tempUser.getUserId()).longValue());
}
开发者ID:NCIP,项目名称:cagrid-general,代码行数:17,代码来源:RegressionTest.java
示例7: testChangeOwner
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
@Test
public void testChangeOwner() throws Exception {
CaArrayUsernameHolder.setUser(STANDARD_USER);
Transaction tx = this.hibernateHelper.beginTransaction();
final CollaboratorGroup created = this.permissionsManagementService.create(TEST);
tx.commit();
assertEquals(STANDARD_USER, created.getOwner().getLoginName());
tx = this.hibernateHelper.beginTransaction();
List<CollaboratorGroup> groups =
this.permissionsManagementService.getCollaboratorGroupsForOwner(created.getOwner().getUserId());
tx.commit();
assertEquals(1, groups.size());
CaArrayUsernameHolder.setUser("systemadministrator");
final User caarrayuser = SecurityUtils.getAuthorizationManager().getUser("caarrayuser");
tx = this.hibernateHelper.beginTransaction();
groups = this.permissionsManagementService.getCollaboratorGroupsForOwner(caarrayuser.getUserId());
assertEquals(0, groups.size());
this.permissionsManagementService.changeOwner(created.getId(), "caarrayuser");
tx.commit();
tx = this.hibernateHelper.beginTransaction();
groups = this.permissionsManagementService.getCollaboratorGroupsForOwner(caarrayuser.getUserId());
tx.commit();
assertEquals(1, groups.size());
}
开发者ID:NCIP,项目名称:caarray,代码行数:26,代码来源:PermissionsManagementServiceIntegrationTest.java
示例8: testCancelJobForInProgressJob
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
@Test
public void testCancelJobForInProgressJob() {
// setup data for system under test.
setupDataForSystemUnderTest();
// Assert that the number of jobs in the snapshot list equals number of queued jobs.
List<Job> snapshotList = systemUnderTest.getJobsForUser(mock(User.class));
assertEquals(5, snapshotList.size());
// Get the UUID and owner of a job to cancel.
Job originalJob = snapshotList.get(0);
assertTrue(originalJob.getJobStatus().equals(JobStatus.RUNNING));
UUID jobIdToCancel = originalJob.getJobId();
String jobOwner = originalJob.getOwnerName();
User user = mock(User.class);
when(user.getLoginName()).thenReturn(jobOwner);
systemUnderTest.cancelJob(jobIdToCancel.toString(), user);
// Assert that the count of queued jobs is same as before.
snapshotList = systemUnderTest.getJobsForUser(mock(User.class));
assertEquals(5, snapshotList.size());
assertEquals(snapshotList.size(), systemUnderTest.getLength());
assertEquals(snapshotList.size(), systemUnderTest.getJobList().size());
}
开发者ID:NCIP,项目名称:caarray,代码行数:26,代码来源:JobQueueTest.java
示例9: create
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public CollaboratorGroup create(String name) throws CSTransactionException, CSObjectNotFoundException {
LogUtil.logSubsystemEntry(LOG, name);
final Group group = new Group();
group.setGroupName(name);
group.setGroupDesc("Collaborator Group");
SecurityUtils.createGroup(group);
final User user = CaArrayUsernameHolder.getCsmUser();
final CollaboratorGroup cg = new CollaboratorGroup(group, user);
this.collaboratorGroupDao.save(cg);
LogUtil.logSubsystemExit(LOG);
return cg;
}
开发者ID:NCIP,项目名称:caarray,代码行数:22,代码来源:PermissionsManagementServiceBean.java
示例10: modifyPasswordForNewUser
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
public void modifyPasswordForNewUser(String loginName, String password) throws Exception{
User user = new User();
user.setLoginName(loginName);
UserSearchCriteria usc = new UserSearchCriteria(user);
List<User> userList = upm.getObjects(usc);
if(userList.size()>0) {
user = userList.get(0);
user.setPassword(password);
user.setFirstTimeLogin(ZERO);
user.setPasswordExpiryDate(DateUtils.addDays(user.getPasswordExpiryDate(),PASSWORD_EXPIRY_DAYS));
user.setUpdateDate(new java.util.Date());
upm.modifyUser(user);
}
else {
//It should never get here
throw new Exception("The user cannot be found in database. " +
"Please re-register using the Register Now link on the login page.");
}
}
开发者ID:NCIP,项目名称:national-biomedical-image-archive,代码行数:21,代码来源:NCIASecurityManagerImpl.java
示例11: AssertEqualsForUsers
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
private void AssertEqualsForUsers (int iteration, User tempUser)
{
long tempLong;
tempLong = iteration + 1;
//Assertions to check for proper data
assertEquals("\nIncorrect Login Name\n", UserStringArray[iteration][0], tempUser.getLoginName());
assertEquals("\nIncorrect First Name\n", UserStringArray[iteration][1], tempUser.getFirstName());
assertEquals("\nIncorrect Last Name\n", UserStringArray[iteration][2], tempUser.getLastName());
assertEquals("\nIncorrect Department\n", UserStringArray[iteration][3], tempUser.getDepartment());
assertEquals("\nIncorrect EmailId\n", UserStringArray[iteration][4], tempUser.getEmailId());
assertEquals("\nIncorrect Organization Name\n", UserStringArray[iteration][5], tempUser.getOrganization());
assertEquals("\nIncorrect Password\n", UserStringArray[iteration][6], tempUser.getPassword());
assertEquals("\nIncorrect Title\n", UserStringArray[iteration][7], tempUser.getTitle());
assertEquals("\nIncorrect Phone Number\n", UserStringArray[iteration][8], tempUser.getPhoneNumber());
assertEquals("\nIncorrect User ID\n", tempLong+1 , ((Long)tempUser.getUserId()).longValue());
}
开发者ID:NCIP,项目名称:cagrid-general,代码行数:17,代码来源:UserProvisioningManagerTest.java
示例12: execute
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public String execute() throws Exception
{
HttpServletRequest request = ServletActionContext.getRequest();
HttpSession session = request.getSession();
UserProvisioningManager userProvisioningManager = (UserProvisioningManager)session.getAttribute(DisplayConstants.USER_PROVISIONING_MANAGER);
if (userForm != null && userForm.getOperation() != null && userForm.getOperation().equalsIgnoreCase("update"))
{
update(userForm);
userForm.setOperation("");
return read(userForm);
}
else
{
userForm = new AppUserForm();
String loginId = ((LoginForm)session.getAttribute(DisplayConstants.LOGIN_OBJECT)).getLoginId();
User user = userProvisioningManager.getUser(loginId);
userForm.setUserId(Long.toString(user.getUserId()));
return read(userForm);
}
}
开发者ID:NCIP,项目名称:common-security-module,代码行数:25,代码来源:AppUserLoginAction.java
示例13: getSingletonGroup
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
/**
* Get or create the singleton group for the given user.
*
* @param user user to get the singleton group for
* @return the group
* @throws CSTransactionException on CSM error
*/
@SuppressWarnings("unchecked")
private static Group getSingletonGroup(User user) throws CSTransactionException {
final Group g = new Group();
g.setGroupName(SELF_GROUP_PREFIX + user.getLoginName() + " (" + user.getUserId() + ")");
final GroupSearchCriteria gsc = new GroupSearchCriteria(g);
final List<Group> groupList = authMgr.getObjects(gsc);
if (groupList == null || groupList.isEmpty()) {
g.setApplication(getApplication());
g.setGroupDesc("Singleton group for CSM filter performance. Do not edit.");
authMgr.createGroup(g);
authMgr.assignUserToGroup(user.getLoginName(), g.getGroupName());
return g;
}
return groupList.get(0);
}
开发者ID:NCIP,项目名称:caarray,代码行数:23,代码来源:SecurityUtils.java
示例14: createUser
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
protected User createUser() throws CSTransactionException{
User u = new User();
u.setDepartment( "TestDept");
u.setEmailId( "[email protected]");
u.setEndDate( new Date() );
u.setFirstName( "TestFirstName");
u.setLastName( "TestLastName");
u.setLoginName( "TestLoginName"+ System.currentTimeMillis());
u.setOrganization("TestOrg");
u.setPassword( "testPwd");
u.setLastName( "TestLastName");
u.setPhoneNumber( "TestPhone");
u.setStartDate( new Date() );
u.setTitle( "TestTitle");
upm.createUser( u );
return u;
}
开发者ID:NCIP,项目名称:cagrid-general,代码行数:18,代码来源:AuthorizationDAOImplTest.java
示例15: setupUsersAndGroups
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
private void setupUsersAndGroups() {
this.u1 = new User();
this.u1.setLoginName("user1");
this.u1.setFirstName("fff1");
this.u1.setLastName("lll1");
this.u1.setUpdateDate(new Date());
this.u2 = new User();
this.u2.setLoginName("user2");
this.u2.setFirstName("fff2");
this.u2.setLastName("lll2");
this.u2.setUpdateDate(new Date());
this.g1 = new Group();
this.g1.setGroupName("group1");
this.g1.setApplication(SecurityUtils.getApplication());
this.g1.setUpdateDate(new Date());
this.g1.setUsers(new HashSet<User>());
this.g1.getUsers().add(this.u1);
}
开发者ID:NCIP,项目名称:caarray,代码行数:21,代码来源:CaArrayAuditLogProcessorTest.java
示例16: validateUser
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
@Override
public void validateUser(User user) throws CSException{
//For LDAP user, password is empty. Password is not a required field.
DataConfiguration config = ConfigurationHelper.getConfiguration();
log.info("******Inside Validate User(((((()))))))))....");
if(user.getPassword() != null && user.getPassword().trim().length() > 0)
{
validatePassword(user.getPassword());
// added PV below
if(user.getLoginName().equalsIgnoreCase(user.getPassword()))
{
throw new CSException("The password and LoginName should be different values...");
}
// added PV below
if(checkPasswordHistory(user.getLoginName(), user.getPassword(),Integer.parseInt(config.getString("PASSWORD_MATCH_NUM"))))
{
throw new CSException("The password should be different from the previous passwords");
}
}
}
开发者ID:NCIP,项目名称:common-security-module,代码行数:24,代码来源:AuthorizationDAOImpl.java
示例17: createProtectionGroup
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
@SuppressWarnings("PMD.ExcessiveMethodLength")
private static ProtectionGroup createProtectionGroup(Protectable p, User csmUser) throws CSObjectNotFoundException,
CSTransactionException {
final ProtectionElement pe = new ProtectionElement();
final Application application = getApplication();
pe.setApplication(application);
pe.setObjectId(p.getClass().getName());
pe.setAttribute("id");
pe.setValue(p.getId().toString());
pe.setUpdateDate(new Date());
authMgr.createProtectionElement(pe);
final ProtectionGroup pg = new ProtectionGroup();
pg.setApplication(application);
pg.setProtectionElements(Collections.singleton(pe));
pg.setProtectionGroupName("PE(" + pe.getProtectionElementId() + ") group");
pg.setUpdateDate(new Date());
authMgr.createProtectionGroup(pg);
addOwner(pg, csmUser);
assignSystemAdministratorAccess(pg);
return pg;
}
开发者ID:NCIP,项目名称:caarray,代码行数:25,代码来源:SecurityUtils.java
示例18: testRemoveUser
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
private void testRemoveUser() throws CSTransactionException
{
try
{
for (int x = 0; x < NumberOfUsersToTest; x++)
{
User obj = new User();
obj.setLoginName(UserStringArray[x][0]);
SearchCriteria sc = new UserSearchCriteria(obj);
List objList = userProvisioningManager.getObjects(sc);
userProvisioningManager.removeUser(((User) objList.get(0)).getUserId().toString());
}
assertTrue(true);
}
catch (Exception e)
{
assertTrue(false);
}
}
开发者ID:NCIP,项目名称:common-security-module,代码行数:21,代码来源:RegressionTest.java
示例19: testGetUserById
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
private void testGetUserById() throws CSObjectNotFoundException
{
try
{
for (int x = 0; x < NumberOfUsersToTest; x++)
{
User obj = new User();
obj.setLoginName(UserStringArray[x][0]);
SearchCriteria sc = new UserSearchCriteria(obj);
List appList = userProvisioningManager.getObjects(sc);
User tempUser = userProvisioningManager.getUserById(((User) appList.get(0)).getUserId().toString());
AssertEqualsForUsers(x, tempUser);
}
assertTrue(true);
}
catch (Exception e)
{
assertTrue(false);
}
}
开发者ID:NCIP,项目名称:common-security-module,代码行数:22,代码来源:RegressionTest.java
示例20: UserBean
import gov.nih.nci.security.authorization.domainobjects.User; //导入依赖的package包/类
public UserBean(User user) {
this.department = user.getDepartment();
this.emailId = user.getEmailId();
this.firstName = user.getFirstName();
this.lastName = user.getLastName();
this.loginName = user.getLoginName();
this.organization = user.getOrganization();
this.password = user.getPassword();
this.phoneNumber = user.getPhoneNumber();
this.title = user.getTitle();
this.userId = user.getUserId().toString();
this.fullName = this.lastName + ", " + this.firstName;
this.domain = user;
}
开发者ID:NCIP,项目名称:cananolab,代码行数:15,代码来源:UserBean.java
注:本文中的gov.nih.nci.security.authorization.domainobjects.User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论