Search in sources :

Example 81 with AttributeDefinition

use of cz.metacentrum.perun.core.api.AttributeDefinition in project perun by CESNET.

the class urn_perun_user_attribute_def_def_vsupMailAlias method getAttributeDefinition.

public AttributeDefinition getAttributeDefinition() {
    AttributeDefinition attr = new AttributeDefinition();
    attr.setNamespace(AttributesManager.NS_USER_ATTR_DEF);
    attr.setFriendlyName("vsupMailAlias");
    attr.setDisplayName("School mail alias");
    attr.setType(String.class.getName());
    attr.setDescription("Generated school mail alias in a \"name.surname[counter]@vsup.cz\" form. This is a main alias used in Zimbra mail. Value can be empty. On users name change, attribute value must be fixed manually.");
    return attr;
}
Also used : AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition)

Example 82 with AttributeDefinition

use of cz.metacentrum.perun.core.api.AttributeDefinition in project perun by CESNET.

the class urn_perun_user_facility_attribute_def_def_homeMountPoint method getAttributeDefinition.

public AttributeDefinition getAttributeDefinition() {
    AttributeDefinition attr = new AttributeDefinition();
    attr.setNamespace(AttributesManager.NS_USER_FACILITY_ATTR_DEF);
    attr.setFriendlyName("homeMountPoint");
    attr.setDisplayName("Home mount point");
    attr.setType(String.class.getName());
    attr.setDescription("Home mount point.");
    return attr;
}
Also used : AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition)

Example 83 with AttributeDefinition

use of cz.metacentrum.perun.core.api.AttributeDefinition in project perun by CESNET.

the class urn_perun_user_facility_attribute_def_def_shell_passwd_scp method getAttributeDefinition.

public AttributeDefinition getAttributeDefinition() {
    AttributeDefinition attr = new AttributeDefinition();
    attr.setNamespace(AttributesManager.NS_USER_FACILITY_ATTR_DEF);
    attr.setFriendlyName("shell_passwd_scp");
    attr.setDisplayName("Shell for passwd_scp");
    attr.setType(String.class.getName());
    attr.setDescription("Shell password.");
    return attr;
}
Also used : AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition)

Example 84 with AttributeDefinition

use of cz.metacentrum.perun.core.api.AttributeDefinition in project perun by CESNET.

the class AttributesManagerEntryIntegrationTest method getRichAttributesWithHoldersForAttributeDefinitionGetGroupFromUserAndFacility.

@Test
public void getRichAttributesWithHoldersForAttributeDefinitionGetGroupFromUserAndFacility() throws Exception {
    System.out.println(CLASS_NAME + "getRichAttributesWithHoldersForAttributeDefinitionGetGroupFromUserAndFacility");
    //Prepare attribute, create it and set it with testing value
    Attribute attribute = setAttributeInNamespace(AttributesManager.NS_GROUP_ATTR);
    perun.getAttributesManagerBl().setAttribute(sess, group1InVo2, attribute);
    perun.getAttributesManagerBl().setAttribute(sess, group2InVo2, attribute);
    //Prepare richAttribute with holders (attribute is not needed but holders are needed)
    RichAttribute richAttr = new RichAttribute();
    richAttr.setPrimaryHolder(user2);
    richAttr.setSecondaryHolder(facility2);
    List<RichAttribute> listOfRichAttributes = perun.getAttributesManagerBl().getRichAttributesWithHoldersForAttributeDefinition(sess, new AttributeDefinition(attribute), richAttr);
    assertTrue("return two groups", listOfRichAttributes.size() == 2);
    assertTrue("primary holder is type of vo", listOfRichAttributes.get(0).getPrimaryHolder() instanceof Group);
    assertTrue("secondary holder is null", listOfRichAttributes.get(0).getSecondaryHolder() == null);
    List<Group> groups = new ArrayList<Group>();
    for (RichAttribute ra : listOfRichAttributes) {
        groups.add((Group) ra.getPrimaryHolder());
    }
    assertTrue("groups contains group1InVo2", groups.contains(group1InVo2));
    assertTrue("groups contains group2InVo2", groups.contains(group2InVo2));
    assertTrue("richObject have in Attribute our attribute, which was set before", listOfRichAttributes.get(0).getAttribute().equals(attribute));
}
Also used : Group(cz.metacentrum.perun.core.api.Group) Attribute(cz.metacentrum.perun.core.api.Attribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) ArrayList(java.util.ArrayList) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Example 85 with AttributeDefinition

use of cz.metacentrum.perun.core.api.AttributeDefinition in project perun by CESNET.

the class AttributesManagerEntryIntegrationTest method getRichAttributesWithHoldersForAttributeDefinitionGetGroupFromResourceAndGroup.

@Test
public void getRichAttributesWithHoldersForAttributeDefinitionGetGroupFromResourceAndGroup() throws Exception {
    System.out.println(CLASS_NAME + "getRichAttributesWithHoldersForAttributeDefinitionGetGroupFromResourceAndGroup");
    //Prepare attribute, create it and set it with testing value
    Attribute attribute = setAttributeInNamespace(AttributesManager.NS_GROUP_ATTR);
    perun.getAttributesManagerBl().setAttribute(sess, group2InVo2, attribute);
    //Prepare richAttribute with holders (attribute is not needed but holders are needed)
    RichAttribute richAttr = new RichAttribute();
    richAttr.setPrimaryHolder(resource1InVo2);
    richAttr.setSecondaryHolder(group2InVo2);
    List<RichAttribute> listOfRichAttributes = perun.getAttributesManagerBl().getRichAttributesWithHoldersForAttributeDefinition(sess, new AttributeDefinition(attribute), richAttr);
    //Return facilities Administrator too if exists
    assertTrue("return only one group", listOfRichAttributes.size() == 1);
    assertTrue("primary holder is type of vo", listOfRichAttributes.get(0).getPrimaryHolder() instanceof Group);
    assertTrue("secondary holder is null", listOfRichAttributes.get(0).getSecondaryHolder() == null);
    assertTrue("richObject have in primaryAttribute our group", listOfRichAttributes.get(0).getPrimaryHolder().equals(group2InVo2));
    assertTrue("richObject have in Attribute our attribute, which was set before", listOfRichAttributes.get(0).getAttribute().equals(attribute));
}
Also used : Group(cz.metacentrum.perun.core.api.Group) Attribute(cz.metacentrum.perun.core.api.Attribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) RichAttribute(cz.metacentrum.perun.core.api.RichAttribute) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition) AbstractPerunIntegrationTest(cz.metacentrum.perun.core.AbstractPerunIntegrationTest) Test(org.junit.Test)

Aggregations

AttributeDefinition (cz.metacentrum.perun.core.api.AttributeDefinition)396 Attribute (cz.metacentrum.perun.core.api.Attribute)157 ArrayList (java.util.ArrayList)46 Test (org.junit.Test)38 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)33 User (cz.metacentrum.perun.core.api.User)24 RichAttribute (cz.metacentrum.perun.core.api.RichAttribute)22 Vo (cz.metacentrum.perun.core.api.Vo)15 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)14 Facility (cz.metacentrum.perun.core.api.Facility)12 AttributeNotExistsException (cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException)12 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)12 Resource (cz.metacentrum.perun.core.api.Resource)10 LinkedHashMap (java.util.LinkedHashMap)10 Group (cz.metacentrum.perun.core.api.Group)8 Member (cz.metacentrum.perun.core.api.Member)8 PerunSession (cz.metacentrum.perun.core.api.PerunSession)7 ConsistencyErrorException (cz.metacentrum.perun.core.api.exceptions.ConsistencyErrorException)6 WrongAttributeValueException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException)5 WrongReferenceAttributeValueException (cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException)5