Search in sources :

Example 1 with PermissionInfo

use of com.haulmont.restapi.data.PermissionInfo in project cuba by cuba-platform.

the class PermissionsControllerManager method getPermissionInfos.

public Collection<PermissionInfo> getPermissionInfos() {
    Collection<PermissionInfo> result = new ArrayList<>();
    for (PermissionType permissionType : PermissionType.values()) {
        Map<String, Integer> permissionsMap = userSessionSource.getUserSession().getPermissionsByType(permissionType);
        for (Map.Entry<String, Integer> entry : permissionsMap.entrySet()) {
            String target = entry.getKey();
            Integer value = entry.getValue();
            PermissionInfo permissionInfo = new PermissionInfo(permissionType.name(), target, getPermissionValueStr(permissionType, value), value);
            result.add(permissionInfo);
        }
    }
    return result;
}
Also used : PermissionInfo(com.haulmont.restapi.data.PermissionInfo) PermissionType(com.haulmont.cuba.security.entity.PermissionType) ArrayList(java.util.ArrayList) Map(java.util.Map)

Aggregations

PermissionType (com.haulmont.cuba.security.entity.PermissionType)1 PermissionInfo (com.haulmont.restapi.data.PermissionInfo)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1