use of com.haulmont.cuba.core.global.AccessDeniedException in project cuba by cuba-platform.
the class FileBrowser method init.
@Override
public void init(Map<String, Object> params) {
super.init(params);
filesTable.addAction(new ItemTrackingAction("download").withCaption(getMessage("download")).withHandler(event -> {
FileDescriptor fileDescriptor = filesTable.getSingleSelected();
if (fileDescriptor != null) {
exportDisplay.show(fileDescriptor, null);
}
}));
BaseAction multiUploadAction = new BaseAction("multiupload").withCaption(getMessage("multiupload")).withHandler(event -> {
if (!security.isEntityOpPermitted(FileDescriptor.class, EntityOp.READ)) {
throw new AccessDeniedException(PermissionType.ENTITY_OP, FileDescriptor.class.getSimpleName());
}
Window window = openWindow("multiuploadDialog", OpenType.DIALOG);
window.addCloseListener(actionId -> {
if (COMMIT_ACTION_ID.equals(actionId)) {
Collection<FileDescriptor> items = ((MultiUploader) window).getFiles();
for (FileDescriptor fdesc : items) {
boolean modified = filesDs.isModified();
filesDs.addItem(fdesc);
((DatasourceImplementation) filesDs).setModified(modified);
}
filesTable.requestFocus();
}
});
});
multiUploadAction.setEnabled(security.isEntityOpPermitted(FileDescriptor.class, EntityOp.CREATE));
multiUploadBtn.setAction(multiUploadAction);
}
Aggregations