use of cz.metacentrum.perun.core.impl.PerunSessionImpl in project perun by CESNET.
the class PerunBlImpl method getPerunSession.
/**
* This method is used only internally.
*
*/
public PerunSession getPerunSession() throws InternalErrorException {
PerunPrincipal principal = new PerunPrincipal(INTERNALPRINCIPAL, ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL);
PerunClient client = new PerunClient();
return new PerunSessionImpl(this, principal, client);
}
use of cz.metacentrum.perun.core.impl.PerunSessionImpl in project perun by CESNET.
the class urn_perun_member_group_attribute_def_virt_isGroupAdminTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_member_group_attribute_def_virt_isGroupAdmin();
usersManager = perun.getUsersManager();
vosManager = perun.getVosManager();
membersManager = perun.getMembersManager();
groupsManager = perun.getGroupsManager();
final PerunPrincipal pp = new PerunPrincipal("perunTests", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL);
this.session = new PerunSessionImpl(perun, pp, new PerunClient());
this.attrDef = classInstance.getAttributeDefinition();
this.attribute = new Attribute(attrDef);
this.user = setUpUser();
this.vo = setUpVo();
this.member = setUpMember(vo);
this.group = setUpGroup(vo, member);
}
use of cz.metacentrum.perun.core.impl.PerunSessionImpl in project perun by CESNET.
the class ModulesUtilsEntryIntegrationTest method haveTheSameAttributeWithTheSameNamespace2ForGroup.
@Test
public void haveTheSameAttributeWithTheSameNamespace2ForGroup() throws Exception {
System.out.println(CLASS_NAME + "haveTheSameAttributeWithTheSameNamespace2ForGroup");
vo = setUpVo();
facility = setUpFacility();
resource = setUpResource();
group = setUpGroup();
List<Group> groups = new ArrayList<Group>();
groups.add(group);
List<Attribute> attrs = setUpGroupAttribute();
perun.getAttributesManagerBl().setAttribute(sess, group, attrs.get(0));
Attribute attr = attrs.get(0);
attr.setValue("Jina value");
assertEquals(1, modulesUtilsBl.haveTheSameAttributeWithTheSameNamespace((PerunSessionImpl) sess, group, attrs.get(0)));
}
use of cz.metacentrum.perun.core.impl.PerunSessionImpl in project perun by CESNET.
the class ModulesUtilsEntryIntegrationTest method haveTheSameAttributeWithTheSameNamespace2ForResource.
@Test
public void haveTheSameAttributeWithTheSameNamespace2ForResource() throws Exception {
System.out.println(CLASS_NAME + "haveTheSameAttributeWithTheSameNamespace2");
vo = setUpVo();
facility = setUpFacility();
resource = setUpResource();
List<Resource> resources = new ArrayList<Resource>();
resources.add(resource);
List<Attribute> attrs = setUpResourceAttribute();
perun.getAttributesManagerBl().setAttribute(sess, resource, attrs.get(0));
Attribute attr = attrs.get(0);
attr.setValue("Jina value");
assertEquals(1, modulesUtilsBl.haveTheSameAttributeWithTheSameNamespace((PerunSessionImpl) sess, resource, attrs.get(0)));
}
use of cz.metacentrum.perun.core.impl.PerunSessionImpl in project perun by CESNET.
the class ModulesUtilsEntryIntegrationTest method haveRightToWriteAttributeInAnyGroupOrResource.
@Test
public void haveRightToWriteAttributeInAnyGroupOrResource() throws Exception {
System.out.println(CLASS_NAME + "haveRightToWriteAttributeInAnyGroupOrResource");
Attribute minGID = new Attribute(perun.getAttributesManagerBl().getAttributeDefinition(sess, AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-minGID"));
perun.getAttributesManagerBl().setAttribute(sess, namespace, minGID);
vo = setUpVo();
facility = setUpFacility();
resource = setUpResource();
group = setUpGroup();
List<Group> groups = new ArrayList<Group>();
List<Resource> resources = new ArrayList<Resource>();
groups.add(group);
resources.add(resource);
assertTrue(modulesUtilsBl.haveRightToWriteAttributeInAnyGroupOrResource((PerunSessionImpl) sess, groups, null, minGID, minGID));
assertTrue(modulesUtilsBl.haveRightToWriteAttributeInAnyGroupOrResource((PerunSessionImpl) sess, null, resources, minGID, minGID));
assertTrue(modulesUtilsBl.haveRightToWriteAttributeInAnyGroupOrResource((PerunSessionImpl) sess, groups, resources, minGID, minGID));
assertFalse(modulesUtilsBl.haveRightToWriteAttributeInAnyGroupOrResource((PerunSessionImpl) sess, null, null, minGID, minGID));
}
Aggregations