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


Java ProtectionGroup类代码示例

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


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

示例1: getProtectionGroup

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
private static ProtectionGroup getProtectionGroup(Protectable p) {
    final String queryString =
            "SELECT pg FROM " + ProtectionGroup.class.getName()
                    + " pg join pg.protectionElements pe inner join fetch pg.protectionElements pe2"
                    + " left join fetch pe2.owners "
                    + " WHERE pg.protectionGroupName LIKE 'PE(%) group' AND pe.objectId = :objectId "
                    + "  AND pe.attribute = 'id' AND pe.value = :value";
    Session s = null;
    try {
        s =
                HibernateSessionFactoryHelper.getAuditSession(ApplicationSessionFactory
                        .getSessionFactory(caarrayAppName));
        final Query q = s.createQuery(queryString);
        q.setString("objectId", getUnderlyingEntityClass(p).getName());
        q.setString("value", p.getId().toString());
        return (ProtectionGroup) q.uniqueResult();
    } catch (final Exception e) {
        throw new IllegalStateException("couldn't execute hibernate query: " + e);
    } finally {
        if (s != null) {
            s.close();
        }
    }
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:25,代码来源:SecurityUtils.java

示例2: testModifyProtectionGroup

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
private void testModifyProtectionGroup() throws CSTransactionException, CSObjectNotFoundException 
{
	byte tempFlag = 0;
	ProtectionGroup tempProtectionGroup = new ProtectionGroup();
	java.util.Date tempDate = new java.util.Date();
	
	tempProtectionGroup = userProvisioningManager.getProtectionGroupById("4");
	
	tempProtectionGroup.setProtectionGroupName(ProtectionGroupStringArray[3][0] + "Modified");
	tempProtectionGroup.setProtectionGroupDescription(ProtectionGroupStringArray[3][1] + "Modified");
	tempProtectionGroup.setUpdateDate(tempDate);	
	tempProtectionGroup.setLargeElementCountFlag(tempFlag);
	
	userProvisioningManager.modifyProtectionGroup(tempProtectionGroup);
	
	tempProtectionGroup = userProvisioningManager.getProtectionGroupById("4");
	assertEquals("\nModifyProtectionGroup did not modify the Group Name\n", ProtectionGroupStringArray[3][0] + "Modified", tempProtectionGroup.getProtectionGroupName());
	assertEquals("\nModifyProtectionGroup did not modify the Group Description\n", ProtectionGroupStringArray[3][1] + "Modified", tempProtectionGroup.getProtectionGroupDescription());
	assertEquals("\nModifyProtectionGroup did not modify the Large Element Count Flag\n", tempFlag, tempProtectionGroup.getLargeElementCountFlag());
	//assertEquals("\nModifyProtectionGroup did not modify the UpdateDate\n", tempDate, tempProtectionGroup.getUpdateDate());
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:22,代码来源:UserProvisioningManagerTest.java

示例3: testProtectionGroupCreate

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
public void testProtectionGroupCreate(){
	//UserProvisioningManager upm = SecurityServiceProvider.getUserProvisioningManger("Security");
	
	try{
		for(int i=1;i<101;i++){
			ProtectionGroup pg = new ProtectionGroup();
			pg.setProtectionGroupName("protection_group_name_="+i);
			pg.setProtectionGroupDescription("PG_Desc_"+i);
			upm.createProtectionGroup(pg);
			System.out.println("The returned id is"+pg.getProtectionGroupId());
		}
		
		
	}catch(Exception ex){
		ex.printStackTrace();
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:18,代码来源:TestClient.java

示例4: testCreateProtectionGroup

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
private void testCreateProtectionGroup() throws CSTransactionException
{
	byte tempFlag = 0;
	for (int x = 0; x < NumberOfProtectionGroupsToTest; x++)
	{
		ProtectionGroup tempProtectionGroup = new ProtectionGroup();
		java.util.Date CurrentTime = new java.util.Date();

		tempProtectionGroup.setProtectionGroupName(ProtectionGroupStringArray[x][0]);
		tempProtectionGroup.setProtectionGroupDescription(ProtectionGroupStringArray[x][1]);
		tempProtectionGroup.setUpdateDate(CurrentTime);

		tempProtectionGroup.setLargeElementCountFlag(tempFlag);
		if (tempFlag == 1)
			tempFlag = 0;
		else
			tempFlag = 1;

		userProvisioningManager.createProtectionGroup(tempProtectionGroup);
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:22,代码来源:RegressionTest.java

示例5: testRemoveProtectionGroup

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
private void testRemoveProtectionGroup() throws CSTransactionException
{
	try
	{
		for (int x = 0; x < NumberOfProtectionGroupsToTest; x++)
		{
			ProtectionGroup obj = new ProtectionGroup();
			obj.setProtectionGroupName(ProtectionGroupStringArray[x][0]);
			SearchCriteria sc = new ProtectionGroupSearchCriteria(obj);
			List objList = userProvisioningManager.getObjects(sc);
			userProvisioningManager.removeProtectionGroup(((ProtectionGroup) objList.get(0)).getProtectionGroupId().toString());
		}
		assertTrue(true);
	}
	catch (Exception e)
	{
		assertTrue(false);
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:20,代码来源:RegressionTest.java

示例6: createProtectionElement

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

示例7: testCreateProtectionGroup

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
private void testCreateProtectionGroup() throws CSTransactionException 
{
	
	byte tempFlag = 0;
	for (int x=0; x<NumberOfProtectionGroupsToTest; x++)
	{
		ProtectionGroup tempProtectionGroup = new ProtectionGroup();
		java.util.Date CurrentTime = new java.util.Date();

		tempProtectionGroup.setProtectionGroupName(ProtectionGroupStringArray[x][0]);
		tempProtectionGroup.setProtectionGroupDescription(ProtectionGroupStringArray[x][1]);
		tempProtectionGroup.setUpdateDate(CurrentTime);
		
		tempProtectionGroup.setLargeElementCountFlag(tempFlag);
		if (tempFlag == 1)
			tempFlag = 0;
		else
			tempFlag = 1;
		
		userProvisioningManager.createProtectionGroup(tempProtectionGroup);
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:23,代码来源:UserProvisioningManagerTest.java

示例8: testGetProtectionGroupById

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
private void testGetProtectionGroupById() throws CSObjectNotFoundException 
{
	ProtectionGroup tempProtectionGroup;
	String tempString = "";
	byte tempFlag = 0;
	
	for(int x=0; x<NumberOfProtectionGroupsToTest; x++)
	{
		//java.util.Date CurrentTime = new java.util.Date();
		tempString = Integer.toString(x+1);
		tempProtectionGroup = userProvisioningManager.getProtectionGroupById(tempString);
		
		assertEquals("\nIncorrect Protection Group Name\n", ProtectionGroupStringArray[x][0], tempProtectionGroup.getProtectionGroupName() );
		assertEquals("\nIncorrect Protection Group Desc\n", ProtectionGroupStringArray[x][1], tempProtectionGroup.getProtectionGroupDescription() );
		//assertEquals("\nIncorrect Update Date\n", CurrentTime, tempRole.getUpdateDate() );
		assertEquals("\nIncorrect LargeElementCountFlag\n", tempFlag, tempProtectionGroup.getLargeElementCountFlag() );
		if (tempFlag == 1)
			tempFlag = 0;
		else
			tempFlag = 1;
	}
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:23,代码来源:UserProvisioningManagerTest.java

示例9: testGetProtectionGroups

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
private void testGetProtectionGroups() throws CSObjectNotFoundException 
{
	List tempPGList = userProvisioningManager.getProtectionGroups();

	
    Iterator i = tempPGList.iterator();
    while (i.hasNext())
    {
    	ProtectionGroup tempProtectionGroup = (ProtectionGroup) i.next();
    	AssertEqualsForTextInProtectionGroup(Integer.parseInt(Long.toString(((Long)tempProtectionGroup.getProtectionGroupId()).longValue() - 1)), tempProtectionGroup);
 
    }

	if (tempPGList.size() != (long)NumberOfProtectionGroupsToTest || tempPGList == null || tempPGList.isEmpty())
    {
    	String tempString = "";
    	tempString = "\nThe Number of PGs in the DB is different than origionally created\nExpected: " + NumberOfProtectionGroupsToTest + "\nActual: " + tempPGList.size() + "\n";
   								 										
    	fail(tempString);
    }
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:22,代码来源:UserProvisioningManagerTest.java

示例10: handleSampleSecurity

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
private static void handleSampleSecurity(Group targetGroup, ProtectionGroup samplePg,
        SampleSecurityLevel securityLevel, Role readRole, Role writeRole) {
    final List<Role> roles = new ArrayList<Role>();
    if (securityLevel.isAllowsRead()) {
        roles.add(readRole);
    }
    if (securityLevel.isAllowsWrite()) {
        roles.add(writeRole);
    }
    try {
        AuthorizationManagerExtensions.assignGroupRoleToProtectionGroup(samplePg, targetGroup, roles,
                getApplication());
    } catch (final CSTransactionException e) {
        LOG.warn("Could not assign sample group roles corresponding to profile " + e.getMessage(), e);
    }
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:17,代码来源:SecurityUtils.java

示例11: retrieveManagedStudyConfigurations

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
/**
     * {@inheritDoc}
     */
    @Override
    public Set<StudyConfiguration> retrieveManagedStudyConfigurations(String username, Collection<Study> studies)
        throws CSException {
        if (!doesUserExist(username)) {
            return new HashSet<StudyConfiguration>();
        }
        Set<StudyConfiguration> managedStudies = new HashSet<StudyConfiguration>();
        Set<ProtectionGroup> studyManagerProtectionGroups =
            retrieveProtectionGroups(String.valueOf(retrieveCsmUser(username).getUserId()), STUDY_MANAGER_ROLE);
        Set<Long> managedStudyIds = retrieveStudyIds(studyManagerProtectionGroups);
        for (Study study : studies) {
            // I think there's a bug with this function, so having to do it the hard way.
//            if (getAuthorizationManager().checkPermission(username, STUDY_OBJECT, STUDY_ATTRIBUTE,
//                                String.valueOf(study.getId()), Constants.CSM_UPDATE_PRIVILEGE)) {
//                managedStudies.add(study.getStudyConfiguration());
//            }
            if (managedStudyIds.contains(study.getId())) {
                managedStudies.add(study.getStudyConfiguration());
            }
        }
        return managedStudies;
    }
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:26,代码来源:SecurityManagerImpl.java

示例12: setUp

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
protected void setUp() {
	protectionGroup1 = new ProtectionGroup();
	protectionGroup1.setProtectionGroupId(new Long(1));
	protectionGroup1.setProtectionGroupName("ProtectionGroup1");

	protectionGroup1copy = new ProtectionGroup();
	protectionGroup1copy.setProtectionGroupId(new Long(1));
	protectionGroup1copy.setProtectionGroupName("ProtectionGroup1");

	protectionGroup1copy2 = new ProtectionGroup();
	protectionGroup1copy2.setProtectionGroupId(new Long(1));
	protectionGroup1copy2.setProtectionGroupName("ProtectionGroup1");

	protectionGroup2 = new ProtectionGroup();
	protectionGroup2.setProtectionGroupId(new Long(2));
	protectionGroup2.setProtectionGroupName("ProtectionGroup2");

	protectionGroup3 = new ProtectionGroup();
	protectionGroup3.setProtectionGroupId(new Long(3));
	protectionGroup3.setProtectionGroupName("ProtectionGroup3");
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:22,代码来源:ProtectionGroupTest.java

示例13: testEquality

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
public void testEquality() {

		assertTrue(protectionGroup1.equals(protectionGroup1copy));
		assertFalse(protectionGroup1.equals(protectionGroup2));
		assertFalse(protectionGroup1.equals(protectionGroup3));
		ProtectionGroup protectionGroup1subtype = new ProtectionGroup() {
		};
		protectionGroup1subtype.setProtectionGroupId(new Long(4));
		protectionGroup1subtype.setProtectionGroupName("ProtectionGroup4");

		assertFalse(protectionGroup1.equals(protectionGroup1subtype));

		assertReflexivity();
		assertSymmetry();
		assertTransitivity();
		assertConsistency();
		assertNullComparison();
	}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:19,代码来源:ProtectionGroupTest.java

示例14: handleProjectSecurity

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
private static void handleProjectSecurity(Group targetGroup, Project project, SecurityLevel securityLevel) {
    final ProtectionGroup pg = getProtectionGroup(project);
    final List<String> roleIds = new ArrayList<String>();
    if (securityLevel != SecurityLevel.NONE && securityLevel != SecurityLevel.NO_VISIBILITY) {
        roleIds.add(getRoleByName(BROWSE_ROLE).getId().toString());
    }
    if (securityLevel.isAllowsRead()) {
        roleIds.add(getRoleByName(READ_ROLE).getId().toString());
    }
    if (securityLevel.isAllowsWrite()) {
        roleIds.add(getRoleByName(WRITE_ROLE).getId().toString());
    }
    if (securityLevel.isPartialRead()) {
        roleIds.add(getRoleByName(PARTIAL_READ_ROLE).getId().toString());
    }
    if (securityLevel.isPartialWrite()) {
        roleIds.add(getRoleByName(PARTIAL_WRITE_ROLE).getId().toString());
    }

    try {
        authMgr.assignGroupRoleToProtectionGroup(pg.getProtectionGroupId().toString(), targetGroup.getGroupId()
                .toString(), roleIds.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
    } catch (final CSTransactionException e) {
        LOG.warn("Could not assign project group roles corresponding to profile " + e.getMessage(), e);
    }
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:27,代码来源:SecurityUtils.java

示例15: retrieveAuthorizedStudyElementsGroupIds

import gov.nih.nci.security.authorization.domainobjects.ProtectionGroup; //导入依赖的package包/类
@SuppressWarnings(UNCHECKED) // CSM API is untyped
private Set<Long> retrieveAuthorizedStudyElementsGroupIds(Set<ProtectionGroup> protectionGroups)
                                                                                throws CSException {
    Set<Long> authorizedStudyElementsGroupIds = new HashSet<Long>();
    for (ProtectionGroup group : protectionGroups) {
        Set<ProtectionElement> elements =
            getAuthorizationManager().getProtectionElements(String.valueOf(group.getProtectionGroupId()));
        for (ProtectionElement element : elements) {
            if (AUTHORIZED_STUDY_ELEMENTS_GROUP_OBJECT.equals(element.getObjectId())
                                                        && NumberUtils.isNumber(element.getValue())) {
                authorizedStudyElementsGroupIds.add(Long.valueOf(element.getValue()));
            }
        }
    }
    return authorizedStudyElementsGroupIds;
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:17,代码来源:SecurityManagerImpl.java


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