Update acces

This commit is contained in:
Holt59 2018-03-04 13:24:40 +01:00
parent c07b55a535
commit d5de1cf2ff

View File

@ -48,4 +48,26 @@ public class AccessRestrictions {
this.restrictions = restrictions; this.restrictions = restrictions;
} }
/**
* // TODO:
*
* isRestrictedTo(AccessMode.FOOT, EnumSet.of(Restriction.PRIVATE,
* Restriction.DESTINATION));
*
* @param mode
* @param restrictions
* @return
*/
public boolean isAllowedForAny(AccessMode mode, EnumSet<AccessRestriction> restrictions) {
AccessRestriction modeRestrictions = this.restrictions.getOrDefault(mode, AccessRestriction.UNKNOWN);
if (modeRestrictions == AccessRestriction.UNKNOWN) {
return true;
}
return restrictions.contains(modeRestrictions);
}
public boolean isAllowedFor(AccessMode mode, AccessRestriction restrictions) {
return isAllowedForAny(mode, EnumSet.of(restrictions));
}
} }