use of com.haulmont.cuba.gui.config.PermissionConfig in project cuba by cuba-platform.
the class EntityPermissionTargetsDatasource method loadData.
@Override
protected void loadData(Map<String, Object> params) {
if (permissionDs == null)
return;
if (targets == null) {
targets = new ArrayList<>();
PermissionConfig permissionConfig = AppBeans.get(PermissionConfig.class);
List<OperationPermissionTarget> entities = permissionConfig.getEntities(userSessionSource.getLocale());
for (OperationPermissionTarget target : entities) {
try {
OperationPermissionTarget cloneTarget = target.clone();
loadPermissionVariants(cloneTarget);
attachListener(cloneTarget);
targets.add(cloneTarget);
} catch (CloneNotSupportedException e) {
throw new RuntimeException("Can't clone permission target", e);
}
}
}
data.clear();
targets.stream().filter(permittedEntityFilter).filter(t -> permissionsFilter == null || permissionsFilter.test(t)).forEach(t -> data.put(t.getId(), t));
}
use of com.haulmont.cuba.gui.config.PermissionConfig in project cuba by cuba-platform.
the class MultiplePermissionTargetsDatasource method loadData.
@Override
protected void loadData(Map<String, Object> params) {
if (permissionDs == null)
return;
if (targets == null) {
targets = new ArrayList<>();
PermissionConfig permissionConfig = AppBeans.get(PermissionConfig.class);
List<MultiplePermissionTarget> entityAttrs = permissionConfig.getEntityAttributes(AppBeans.get(UserSessionSource.class).getLocale());
for (MultiplePermissionTarget target : entityAttrs) {
try {
MultiplePermissionTarget cloneTarget = target.clone();
loadPermissionVariants(cloneTarget);
attachListener(cloneTarget);
targets.add(cloneTarget);
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
}
clear();
targets.stream().filter(permittedEntityFilter).filter(t -> permissionsFilter == null || permissionsFilter.test(t)).forEach(t -> data.put(t.getId(), t));
}
Aggregations