Search in sources :

Example 21 with AttributeDefinition

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

the class AttributesManagerEntry method checkAttributeValue.

public void checkAttributeValue(PerunSession sess, Facility facility, User user, Attribute attribute) throws PrivilegeException, InternalErrorException, FacilityNotExistsException, UserNotExistsException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException, AttributeNotExistsException {
    Utils.checkPerunSession(sess);
    getAttributesManagerBl().checkAttributeExists(sess, attribute);
    getPerunBl().getFacilitiesManagerBl().checkFacilityExists(sess, facility);
    getPerunBl().getUsersManagerBl().checkUserExists(sess, user);
    //Choose to which attributes has the principal access
    if (!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, new AttributeDefinition(attribute), facility, user))
        throw new PrivilegeException("Principal has no access to check attribute = " + new AttributeDefinition(attribute));
    getAttributesManagerBl().checkAttributeValue(sess, facility, user, attribute);
}
Also used : AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition)

Example 22 with AttributeDefinition

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

the class AttributesManagerEntry method checkAttributesValue.

public void checkAttributesValue(PerunSession sess, Member member, List<Attribute> attributes) throws PrivilegeException, InternalErrorException, MemberNotExistsException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException, AttributeNotExistsException {
    Utils.checkPerunSession(sess);
    getAttributesManagerBl().checkAttributesExists(sess, attributes);
    getPerunBl().getMembersManagerBl().checkMemberExists(sess, member);
    //Choose to which attributes has the principal access
    for (Attribute attr : attributes) {
        if (!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, new AttributeDefinition(attr), member, null))
            throw new PrivilegeException("Principal has no access to check attribute = " + new AttributeDefinition(attr));
    }
    getAttributesManagerBl().checkAttributesValue(sess, member, attributes);
}
Also used : Attribute(cz.metacentrum.perun.core.api.Attribute) AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition)

Example 23 with AttributeDefinition

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

the class AttributesManagerEntry method checkAttributeValue.

public void checkAttributeValue(PerunSession sess, User user, Attribute attribute) throws PrivilegeException, InternalErrorException, UserNotExistsException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException, AttributeNotExistsException {
    Utils.checkPerunSession(sess);
    getAttributesManagerBl().checkAttributeExists(sess, attribute);
    getPerunBl().getUsersManagerBl().checkUserExists(sess, user);
    //Choose to which attributes has the principal access
    if (!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, new AttributeDefinition(attribute), user, null))
        throw new PrivilegeException("Principal has no access to check attribute = " + new AttributeDefinition(attribute));
    getAttributesManagerBl().checkAttributeValue(sess, user, attribute);
}
Also used : AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition)

Example 24 with AttributeDefinition

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

the class AttributesManagerEntry method checkAttributeValue.

public void checkAttributeValue(PerunSession sess, UserExtSource ues, Attribute attribute) throws PrivilegeException, InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, AttributeNotExistsException, UserExtSourceNotExistsException, WrongReferenceAttributeValueException {
    Utils.checkPerunSession(sess);
    getAttributesManagerBl().checkAttributeExists(sess, attribute);
    getPerunBl().getUsersManagerBl().checkUserExtSourceExists(sess, ues);
    //Choose to which attributes has the principal access
    if (!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, new AttributeDefinition(attribute), ues, null))
        throw new PrivilegeException("Principal has no access to check attribute = " + new AttributeDefinition(attribute));
    getAttributesManagerBl().checkAttributeValue(sess, ues, attribute);
}
Also used : AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition)

Example 25 with AttributeDefinition

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

the class urn_perun_facility_attribute_def_virt_maxGID method getAttributeDefinition.

public AttributeDefinition getAttributeDefinition() {
    AttributeDefinition attr = new AttributeDefinition();
    attr.setNamespace(AttributesManager.NS_FACILITY_ATTR_VIRT);
    attr.setFriendlyName("maxGID");
    attr.setDisplayName("Max GID");
    attr.setType(Integer.class.getName());
    attr.setDescription("Maximal unix GID allowed.");
    return attr;
}
Also used : AttributeDefinition(cz.metacentrum.perun.core.api.AttributeDefinition)

Aggregations

AttributeDefinition (cz.metacentrum.perun.core.api.AttributeDefinition)764 Attribute (cz.metacentrum.perun.core.api.Attribute)311 PrivilegeException (cz.metacentrum.perun.core.api.exceptions.PrivilegeException)171 ArrayList (java.util.ArrayList)111 Test (org.junit.Test)99 AbstractPerunIntegrationTest (cz.metacentrum.perun.core.AbstractPerunIntegrationTest)79 WrongAttributeAssignmentException (cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException)59 LinkedHashMap (java.util.LinkedHashMap)59 User (cz.metacentrum.perun.core.api.User)58 RichAttribute (cz.metacentrum.perun.core.api.RichAttribute)56 HashMap (java.util.HashMap)42 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)40 Facility (cz.metacentrum.perun.core.api.Facility)38 AttributeNotExistsException (cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException)37 Resource (cz.metacentrum.perun.core.api.Resource)28 Member (cz.metacentrum.perun.core.api.Member)25 Group (cz.metacentrum.perun.core.api.Group)24 Vo (cz.metacentrum.perun.core.api.Vo)23 HashSet (java.util.HashSet)23 WrongReferenceAttributeValueException (cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException)20