use of controllers.deadbolt.Restrict in project coprhd-controller by CoprHD.
the class OrdersApi method allOrders.
@Restrict("TENANT_ADMIN")
public static void allOrders(String startTime, String endTime) {
List<? extends RelatedResourceRep> elements = queryOrders(startTime, endTime);
List<Reference> orders = Lists.newArrayList();
for (RelatedResourceRep element : elements) {
orders.add(newOrderReference(element.getId().toString()));
}
renderApi(orders);
}
use of controllers.deadbolt.Restrict in project coprhd-controller by CoprHD.
the class StorageOSDeadboltHandler method getRoleSetsFromController.
/*
* Query the roles required by the deadbolt annotations. This is used for logging purposes to show what the controller
* requires.
*/
private static List<String> getRoleSetsFromController() {
List<String> roleSets = Lists.newArrayList();
Restrictions restrictions = getActionAnnotation(Restrictions.class);
if (restrictions == null) {
restrictions = getControllerInheritedAnnotation(Restrictions.class);
}
if (restrictions != null) {
Restrict[] restrictArray = restrictions.value();
for (int i = 0; i < restrictArray.length; i++) {
roleSets.add(StringUtils.join(restrictArray[i].value(), " & "));
}
}
Restrict restrict = getActionAnnotation(Restrict.class);
if (restrict == null) {
restrict = getControllerInheritedAnnotation(Restrict.class);
}
if (restrict != null) {
roleSets.add(StringUtils.join(restrict.value(), " & "));
}
return roleSets;
}
Aggregations