Search in sources :

Example 1 with Restrict

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);
}
Also used : NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) Reference(com.emc.vipr.model.catalog.Reference) ApiMapperUtils.newOrderReference(util.api.ApiMapperUtils.newOrderReference) Restrict(controllers.deadbolt.Restrict)

Example 2 with Restrict

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;
}
Also used : Restrict(controllers.deadbolt.Restrict) Restrictions(controllers.deadbolt.Restrictions)

Aggregations

Restrict (controllers.deadbolt.Restrict)2 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 Reference (com.emc.vipr.model.catalog.Reference)1 Restrictions (controllers.deadbolt.Restrictions)1 ApiMapperUtils.newOrderReference (util.api.ApiMapperUtils.newOrderReference)1