@@ -1391,31 +1391,27 @@ public BanOnFacility updateBan(PerunSession sess, BanOnFacility banOnFacility) t
13911391 }
13921392
13931393 @ Override
1394- public void removeBan (PerunSession sess , int banId ) throws PrivilegeException , BanNotExistsException {
1394+ public void removeBan (PerunSession sess , int banId ) throws PrivilegeException , BanNotExistsException , FacilityNotExistsException {
13951395 Utils .checkPerunSession (sess );
1396- BanOnFacility ban = this .getFacilitiesManagerBl ().getBanById (sess , banId );
1397-
1398- Facility facility = new Facility ();
1399- facility .setId (ban .getId ());
1396+ BanOnFacility banOnFacility = this .getFacilitiesManagerBl ().getBanById (sess , banId );
1397+ Facility facility = this .getFacilitiesManagerBl ().getFacilityById (sess , banOnFacility .getFacilityId ());
14001398
14011399 // Authorization
1402- if (!AuthzResolver .authorizedInternal (sess , "removeBan_int_policy" , Arrays .asList (ban , facility ))) {
1400+ if (!AuthzResolver .authorizedInternal (sess , "removeBan_int_policy" , Arrays .asList (banOnFacility , facility ))) {
14031401 throw new PrivilegeException (sess , "removeBan" );
14041402 }
14051403
14061404 getFacilitiesManagerBl ().removeBan (sess , banId );
14071405 }
14081406
14091407 @ Override
1410- public void removeBan (PerunSession sess , int userId , int facilityId ) throws BanNotExistsException , PrivilegeException {
1408+ public void removeBan (PerunSession sess , int userId , int facilityId ) throws BanNotExistsException , PrivilegeException , FacilityNotExistsException {
14111409 Utils .checkPerunSession (sess );
1412- BanOnFacility ban = this .getFacilitiesManagerBl ().getBan (sess , userId , facilityId );
1413-
1414- Facility facility = new Facility ();
1415- facility .setId (ban .getId ());
1410+ BanOnFacility banOnFacility = this .getFacilitiesManagerBl ().getBan (sess , userId , facilityId );
1411+ Facility facility = this .getFacilitiesManagerBl ().getFacilityById (sess , banOnFacility .getFacilityId ());
14161412
14171413 // Authorization
1418- if (!AuthzResolver .authorizedInternal (sess , "removeBan_int_int_policy" , Arrays .asList (ban , facility ))) {
1414+ if (!AuthzResolver .authorizedInternal (sess , "removeBan_int_int_policy" , Arrays .asList (banOnFacility , facility ))) {
14191415 throw new PrivilegeException (sess , "removeBan" );
14201416 }
14211417
0 commit comments