Search in sources :

Example 1 with BanSetForResource

use of cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanSetForResource in project perun by CESNET.

the class ResourcesManagerBlImpl method setBan.

@Override
public BanOnResource setBan(PerunSession sess, BanOnResource banOnResource) throws BanAlreadyExistsException {
    if (this.banExists(sess, banOnResource.getMemberId(), banOnResource.getResourceId()))
        throw new BanAlreadyExistsException(banOnResource);
    banOnResource = getResourcesManagerImpl().setBan(sess, banOnResource);
    getPerunBl().getAuditer().log(sess, new BanSetForResource(banOnResource, banOnResource.getMemberId(), banOnResource.getResourceId()));
    return banOnResource;
}
Also used : BanAlreadyExistsException(cz.metacentrum.perun.core.api.exceptions.BanAlreadyExistsException) BanSetForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanSetForResource)

Example 2 with BanSetForResource

use of cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanSetForResource in project perun by CESNET.

the class urn_perun_member_resource_attribute_def_virt_isBannedTest method setUp.

@Before
public void setUp() {
    classInstance = new urn_perun_member_resource_attribute_def_virt_isBanned();
    session = mock(PerunSessionImpl.class, RETURNS_DEEP_STUBS);
    facility = new Facility(1, "testFacility");
    resource = new Resource(1, "testResource", "des\nc", 1, 1);
    vo = new Vo(1, "testVo", "desc");
    user = new User(1, "name", "surname", "middlename", "title", "title");
    member = new Member(1, 1, 1, Status.VALID);
    isBanned = new Attribute(classInstance.getAttributeDefinition());
    event1 = new BanSetForResource(new BanOnResource(), member.getId(), resource.getId());
    event2 = new BanUpdatedForResource(new BanOnResource(), member.getId(), resource.getId());
    event3 = new BanRemovedForResource(new BanOnResource(), member.getId(), resource.getId());
    event4 = new BanSetForFacility(new BanOnFacility(), user.getId(), facility.getId());
    event5 = new BanUpdatedForFacility(new BanOnFacility(), user.getId(), facility.getId());
    event6 = new BanRemovedForFacility(new BanOnFacility(), user.getId(), facility.getId());
    wrongEvent = new SecurityTeamAssignedToFacility();
}
Also used : BanRemovedForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanRemovedForResource) SecurityTeamAssignedToFacility(cz.metacentrum.perun.audit.events.FacilityManagerEvents.SecurityTeamAssignedToFacility) BanRemovedForFacility(cz.metacentrum.perun.audit.events.FacilityManagerEvents.BanRemovedForFacility) User(cz.metacentrum.perun.core.api.User) Attribute(cz.metacentrum.perun.core.api.Attribute) BanUpdatedForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanUpdatedForResource) Resource(cz.metacentrum.perun.core.api.Resource) BanSetForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanSetForResource) BanOnResource(cz.metacentrum.perun.core.api.BanOnResource) BanUpdatedForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanUpdatedForResource) BanRemovedForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanRemovedForResource) PerunSessionImpl(cz.metacentrum.perun.core.impl.PerunSessionImpl) BanOnResource(cz.metacentrum.perun.core.api.BanOnResource) BanSetForResource(cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanSetForResource) BanOnFacility(cz.metacentrum.perun.core.api.BanOnFacility) Vo(cz.metacentrum.perun.core.api.Vo) BanOnFacility(cz.metacentrum.perun.core.api.BanOnFacility) SecurityTeamAssignedToFacility(cz.metacentrum.perun.audit.events.FacilityManagerEvents.SecurityTeamAssignedToFacility) BanRemovedForFacility(cz.metacentrum.perun.audit.events.FacilityManagerEvents.BanRemovedForFacility) Facility(cz.metacentrum.perun.core.api.Facility) BanUpdatedForFacility(cz.metacentrum.perun.audit.events.FacilityManagerEvents.BanUpdatedForFacility) BanSetForFacility(cz.metacentrum.perun.audit.events.FacilityManagerEvents.BanSetForFacility) Member(cz.metacentrum.perun.core.api.Member) BanSetForFacility(cz.metacentrum.perun.audit.events.FacilityManagerEvents.BanSetForFacility) BanUpdatedForFacility(cz.metacentrum.perun.audit.events.FacilityManagerEvents.BanUpdatedForFacility) Before(org.junit.Before)

Aggregations

BanSetForResource (cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanSetForResource)2 BanRemovedForFacility (cz.metacentrum.perun.audit.events.FacilityManagerEvents.BanRemovedForFacility)1 BanSetForFacility (cz.metacentrum.perun.audit.events.FacilityManagerEvents.BanSetForFacility)1 BanUpdatedForFacility (cz.metacentrum.perun.audit.events.FacilityManagerEvents.BanUpdatedForFacility)1 SecurityTeamAssignedToFacility (cz.metacentrum.perun.audit.events.FacilityManagerEvents.SecurityTeamAssignedToFacility)1 BanRemovedForResource (cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanRemovedForResource)1 BanUpdatedForResource (cz.metacentrum.perun.audit.events.ResourceManagerEvents.BanUpdatedForResource)1 Attribute (cz.metacentrum.perun.core.api.Attribute)1 BanOnFacility (cz.metacentrum.perun.core.api.BanOnFacility)1 BanOnResource (cz.metacentrum.perun.core.api.BanOnResource)1 Facility (cz.metacentrum.perun.core.api.Facility)1 Member (cz.metacentrum.perun.core.api.Member)1 Resource (cz.metacentrum.perun.core.api.Resource)1 User (cz.metacentrum.perun.core.api.User)1 Vo (cz.metacentrum.perun.core.api.Vo)1 BanAlreadyExistsException (cz.metacentrum.perun.core.api.exceptions.BanAlreadyExistsException)1 PerunSessionImpl (cz.metacentrum.perun.core.impl.PerunSessionImpl)1 Before (org.junit.Before)1