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


Java Group类代码示例

本文整理汇总了Java中gov.nih.nci.security.authorization.domainobjects.Group的典型用法代码示例。如果您正苦于以下问题:Java Group类的具体用法?Java Group怎么用?Java Group使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Group类属于gov.nih.nci.security.authorization.domainobjects包,在下文中一共展示了Group类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGroupNamesForUser

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
/**
 * Get group names for user in a list. Method added for restful services
 * @param userId
 * @return
 * @throws SecurityException
 */
public List<String> getGroupNamesForUser(String userId)
		throws SecurityException {
	
	List<String> groupNames = new ArrayList<String>();
	try {
		Set groups = this.authorizationManager.getGroups(userId);
		for (Object obj : groups) {
			Group group = (Group) obj;
			groupNames.add(group.getGroupName());
		}
	} catch (Exception e) {
		logger.error("Error in getting the groups user is in.", e);
		throw new SecurityException();
	}
	return groupNames;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:23,代码来源:SecurityService.java

示例2: retrieveProtectionGroups

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static Set<ProtectionGroup> retrieveProtectionGroups(String userId, String myRole)
throws CSException {
    Set<ProtectionGroup> protectionGroups = new HashSet<ProtectionGroup>();
    Set<Group> groups = getAuthorizationManager().getGroups(userId);
    for (Group group : groups) {
        Set<ProtectionGroupRoleContext> pgrcs =
            getAuthorizationManager().getProtectionGroupRoleContextForGroup(String.valueOf(group.getGroupId()));
        for (ProtectionGroupRoleContext pgrc : pgrcs) {
            for (Role role : (Set<Role>) pgrc.getRoles()) {
                if (myRole.equals(role.getName())) {
                    protectionGroups.add(pgrc.getProtectionGroup());
                    break;
                }
            }
        }
    }
    return protectionGroups;
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:20,代码来源:SecurityHelper.java

示例3: setUp

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    securityManager = new SecurityManagerImpl();
    securityManager.setAuthorizationManagerFactory(authManagerFactory);

    authorizedStudyElementsGroup = new AuthorizedStudyElementsGroup();
    authorizedStudyElementsGroup.setId(Long.valueOf(1));
    authorizedStudyElementsGroup.setAuthorizedGroup(new Group());
    studyConfiguration = new StudyConfiguration();
    UserWorkspace workspace = new UserWorkspace();
    studyConfiguration.setUserWorkspace(workspace);
    workspace.setUsername("user");

    Group group = new Group();
    group.setGroupName("Authorized Group");;
    group.setGroupDesc("This is an Authorized Group");
    AuthorizedStudyElementsGroup authorizedGroup = new AuthorizedStudyElementsGroup();
    authorizedGroup.setAuthorizedGroup(group);
    studyConfiguration.getAuthorizedStudyElementsGroups().add(authorizedGroup);
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:21,代码来源:SecurityManagerImplTest.java

示例4: createProtectionElement

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void createProtectionElement(StudyConfiguration studyConfiguration,
        AuthorizedStudyElementsGroup authorizedStudyElementsGroup) throws CSException {
    if (doesUserExist(studyConfiguration.getUserWorkspace().getUsername())) {
        User user = retrieveCsmUser(studyConfiguration.getUserWorkspace().getUsername());
        ProtectionElement element = createProtectionElementInstance(authorizedStudyElementsGroup);
        if (element == null) {
            throw new CSInsufficientAttributesException();
        } else {
            Group authorizedGroup = authorizedStudyElementsGroup.getAuthorizedGroup();
            element.setProtectionElementName(authorizedGroup.getGroupName());
            Set<User> owners = new HashSet<User>();
            owners.add(user);
            element.setOwners(owners);

            Set<ProtectionGroup> protectionGroups = new HashSet<ProtectionGroup>();
            protectionGroups.addAll(retrieveProtectionGroups(authorizedGroup, STUDY_INVESTIGATOR_ROLE));
            protectionGroups.addAll(retrieveProtectionGroups(authorizedGroup, STUDY_MANAGER_ROLE));
            element.setProtectionGroups(protectionGroups);
            getAuthorizationManager().createProtectionElement(element);
        }
    }

}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:28,代码来源:SecurityManagerImpl.java

示例5: setUpSecurityManager

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
private void setUpSecurityManager() throws Exception {
    secManager = mock(SecurityManager.class);
    when(secManager.getAuthorizationManager()).thenReturn(authManager);
    when(secManager.doesUserExist(eq(USER_EXISTS))).thenReturn(Boolean.TRUE);
    when(secManager.doesUserExist(eq(USERNAME))).thenReturn(Boolean.TRUE);
    when(secManager.retrieveManagedStudyConfigurations(anyString(), anyCollectionOf(Study.class))).thenAnswer(new Answer<Set<StudyConfiguration>>() {

        @SuppressWarnings("unchecked")
        @Override
        public Set<StudyConfiguration> answer(InvocationOnMock invocation) throws Throwable {
            Set<StudyConfiguration> results = new HashSet<StudyConfiguration>();
            Collection<Study> studies = (Collection<Study>) invocation.getArguments()[1];
            if (CollectionUtils.isNotEmpty(studies)) {
                for (Study study : studies) {
                    results.add(study.getStudyConfiguration());
                }
            }
            return results;
        }
    });
    when(secManager.retrieveAuthorizedStudyElementsGroupsForInvestigator(anyString(), anySetOf(AuthorizedStudyElementsGroup.class)))
        .thenReturn(new HashSet<AuthorizedStudyElementsGroup>());
    when(secManager.getUnauthorizedGroups(any(StudyConfiguration.class))).thenReturn(new ArrayList<Group>());
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:25,代码来源:AbstractSecurityEnabledMockitoTest.java

示例6: testModifyGroup

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
private void testModifyGroup() throws CSTransactionException, CSObjectNotFoundException 
{
	Group tempGroup = new Group();
	java.util.Date CurrentTime = new java.util.Date();
	
	tempGroup = userProvisioningManager.getGroupById("4");
	
	tempGroup.setGroupName(GroupStringArray[3][0] + "Modified");
	tempGroup.setGroupDesc(GroupStringArray[3][1] + "Modified");
	tempGroup.setUpdateDate(CurrentTime);
	
	userProvisioningManager.modifyGroup(tempGroup);
	
	tempGroup = userProvisioningManager.getGroupById("4");
	
	assertEquals("\nmodifyGroup did not modify Group Name\n", GroupStringArray[3][0] + "Modified", tempGroup.getGroupName());
	assertEquals("\nmodifyGroup did not modify Group Description\n", GroupStringArray[3][1] + "Modified", tempGroup.getGroupDesc());
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:19,代码来源:UserProvisioningManagerTest.java

示例7: testGetGroupById

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
private void testGetGroupById() throws CSObjectNotFoundException 
{
	Group tempGroup;
	String tempString = "";
	
	for (int x=0; x<NumberOfGroupsToTest; x++)  //NumberOfUsersToTest; x++)
	{
		tempString = Integer.toString(x+1);
		
		//Retrieve the User based off the login ID (see setup() for initialization of UserStringArray)
		tempGroup = userProvisioningManager.getGroupById(tempString);
		
		assertEquals("\nIncorrect Group Name\n", GroupStringArray[x][0], tempGroup.getGroupName() );
		assertEquals("\nIncorrect Group Desc\n", GroupStringArray[x][1], tempGroup.getGroupDesc() );
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:17,代码来源:UserProvisioningManagerTest.java

示例8: create

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的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

示例9: testRemoveGroup

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
private void testRemoveGroup() throws CSTransactionException
{

	try
	{
		for (int x = 0; x < NumberOfGroupsToTest; x++)
		{
			Group obj = new Group();
			obj.setGroupName(GroupStringArray[x][0]);
			SearchCriteria sc = new GroupSearchCriteria(obj);
			List objList = userProvisioningManager.getObjects(sc);
			userProvisioningManager.removeGroup(((Group) objList.get(0)).getGroupId().toString());
		}
		assertTrue(true);
	}
	catch (Exception e)
	{
		assertTrue(false);
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:21,代码来源:RegressionTest.java

示例10: testGetGroupById

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
private void testGetGroupById() throws CSObjectNotFoundException
{
	Group tempGroup;
	for (int x = 0; x < NumberOfGroupsToTest; x++)
	{
		Group obj = new Group();
		obj.setGroupName(GroupStringArray[x][0]);
		SearchCriteria sc = new GroupSearchCriteria(obj);
		List objList = userProvisioningManager.getObjects(sc);
		tempGroup = userProvisioningManager.getGroupById(((Group) objList.get(0)).getGroupId().toString());
		
		assertEquals("\nIncorrect Group Name\n", GroupStringArray[x][0], tempGroup.getGroupName());
		assertEquals("\nIncorrect Group Desc\n", GroupStringArray[x][1], tempGroup.getGroupDesc());
		
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:17,代码来源:RegressionTest.java

示例11: testAddAuthorizedStudyElementsGroups

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
@Test
public void testAddAuthorizedStudyElementsGroups() throws ConnectionException, ExperimentNotFoundException, CSException {
    StudyConfiguration studyConfiguration = new StudyConfiguration();
    AuthorizedStudyElementsGroup authorizedStudyElementsGroup = new AuthorizedStudyElementsGroup();
    authorizedStudyElementsGroup.setAuthorizedGroup(new Group());
    studyManagementService.addAuthorizedStudyElementsGroup(studyConfiguration, authorizedStudyElementsGroup);
    authorizedStudyElementsGroup.setId(Long.valueOf(1));
    assertTrue(studyConfiguration.getAuthorizedStudyElementsGroups().contains(authorizedStudyElementsGroup));
    assertTrue(daoStub.saveCalled);
    // test if username is not found
    daoStub.clear();
    StudyConfiguration studyConfiguration2 = new StudyConfiguration();
    UserWorkspace userWorkspace = new UserWorkspace();
    userWorkspace.setUsername("NAMENOTFOUND");
    studyConfiguration2.setUserWorkspace(userWorkspace);
    AuthorizedStudyElementsGroup authorizedStudyElementsGroup2 = new AuthorizedStudyElementsGroup();
    authorizedStudyElementsGroup2.setAuthorizedGroup(new Group());
    studyManagementService.addAuthorizedStudyElementsGroup(studyConfiguration2, authorizedStudyElementsGroup2);
    authorizedStudyElementsGroup.setId(Long.valueOf(1));
    assertTrue(studyConfiguration2.getAuthorizedStudyElementsGroups().contains(authorizedStudyElementsGroup2));
    assertTrue(daoStub.saveCalled);

}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:24,代码来源:StudyManagementServiceTest.java

示例12: testRemoveUsers

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
@Test
public void testRemoveUsers() throws CSTransactionException, CSObjectNotFoundException {
    User owner = new User();
    Group group = new Group();
    CollaboratorGroup cg = new CollaboratorGroup(group, owner);
    List<Long> toAdd = new ArrayList<Long>();
    toAdd.add(1L);

    action.setTargetGroup(cg);
    action.setUsers(toAdd);
    action.removeUsers();

    List<Long> stubRemove = pstub.getRemovedUsers();
    CollaboratorGroup stubGroup = pstub.getCurrentGroup();
    assertEquals(toAdd.size(), stubRemove.size());
    assertEquals(cg, stubGroup);
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:18,代码来源:CollaboratorsActionTest.java

示例13: testGroupCreate

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
public void testGroupCreate(){
	//UserProvisioningManager upm = SecurityServiceProvider.getUserProvisioningManger("Security");
	
	try{
		for(int i=1;i<101;i++){
			Group grp = new Group();
			grp.setGroupName("Group_Name_"+i);
			grp.setGroupDesc("Group_Desc_"+i);
			upm.createGroup(grp);
		}
		
		
	}catch(Exception ex){
		ex.printStackTrace();
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:17,代码来源:TestClient.java

示例14: retrieveProtectionGroups

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
@SuppressWarnings(UNCHECKED) // CSM API is untyped
private Set<ProtectionGroup> retrieveProtectionGroups(String userId, String csmRoleToBeRetrieved)
        throws CSException {
    Set<ProtectionGroup> protectionGroups = new HashSet<ProtectionGroup>();
    Set<Group> groups = getAuthorizationManager().getGroups(userId);
    for (Group group : groups) {
        Set<ProtectionGroupRoleContext> pgrcs =
            getAuthorizationManager().getProtectionGroupRoleContextForGroup(String.valueOf(group.getGroupId()));
        for (ProtectionGroupRoleContext pgrc : pgrcs) {
            for (Role role : (Set<Role>) pgrc.getRoles()) {
                if (csmRoleToBeRetrieved.equals(role.getName())) {
                    protectionGroups.add(pgrc.getProtectionGroup());
                    break;
                }
            }
        }
    }
    return protectionGroups;
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:20,代码来源:SecurityManagerImpl.java

示例15: setUp

import gov.nih.nci.security.authorization.domainobjects.Group; //导入依赖的package包/类
protected void setUp() {
	group1 = new Group();
	group1.setGroupId(new Long(1));
	group1.setGroupName("Group1");

	group1copy = new Group();
	group1copy.setGroupId(new Long(1));
	group1copy.setGroupName("Group1");

	group1copy2 = new Group();
	group1copy2.setGroupId(new Long(1));
	group1copy2.setGroupName("Group1");

	group2 = new Group();
	group2.setGroupId(new Long(2));
	group2.setGroupName("Group2");

	group3 = new Group();
	group3.setGroupId(new Long(3));
	group3.setGroupName("Group3");
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:22,代码来源:GroupTest.java


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