use of com.emc.metalnx.core.domain.entity.DataGridUser in project metalnx-web by irods-contrib.
the class TemplateController method index.
@RequestMapping(value = "/")
public String index(final Model model, final HttpServletRequest request) throws DataGridConnectionRefusedException, DataGridException {
addTemplateFields = new ArrayList<TemplateFieldForm>();
removeTemplateFields = new ArrayList<TemplateFieldForm>();
DataGridUser loggedUser = loggedUserUtils.getLoggedDataGridUser();
String uiMode = (String) request.getSession().getAttribute("uiMode");
if (uiMode == null || uiMode.isEmpty()) {
if (loggedUser.isAdmin()) {
uiMode = UI_ADMIN_MODE;
} else {
uiMode = UI_USER_MODE;
model.addAttribute("homePath", collectionService.getHomeDirectyForCurrentUser());
model.addAttribute("publicPath", collectionService.getHomeDirectyForPublic());
}
}
selectedTemplates.clear();
model.addAttribute("uiMode", uiMode);
model.addAttribute("topnavHeader", headerService.getheader("template"));
return "template/templateManagement";
}
use of com.emc.metalnx.core.domain.entity.DataGridUser in project metalnx-web by irods-contrib.
the class CollectionController method indexViaUrl.
/**
* Responds the collections/ request
*
* @param model
* @return the collection management template
* @throws JargonException
* @throws DataGridException
*/
@RequestMapping(method = RequestMethod.GET)
public String indexViaUrl(final Model model, final HttpServletRequest request, @RequestParam("path") final Optional<String> path, @ModelAttribute("requestHeader") String requestHeader) {
logger.info("indexViaUrl()");
String myPath = path.orElse("");
logger.info("dp Header requestHeader is :: " + requestHeader);
try {
if (myPath.isEmpty()) {
model.addAttribute("topnavHeader", headerService.getheader("collections"));
logger.info("no path, go to home dir");
myPath = cs.getHomeDirectyForCurrentUser();
} else {
logger.info("path provided...go to:{}", path);
// TODO: do I need to worry about decoding, versus configure
myPath = URLDecoder.decode(myPath);
// in filter? - MCC
// see
// https://stackoverflow.com/questions/25944964/where-and-how-to-decode-pathvariable
}
logger.info("myPath:{}" + myPath);
DataGridUser loggedUser = loggedUserUtils.getLoggedDataGridUser();
String uiMode = (String) request.getSession().getAttribute("uiMode");
sourcePaths = MiscIRODSUtils.breakIRODSPathIntoComponents(myPath);
CollectionAndPath collectionAndPath = MiscIRODSUtils.separateCollectionAndPathFromGivenAbsolutePath(myPath);
this.parentPath = collectionAndPath.getCollectionParent();
this.currentPath = myPath;
if (uiMode == null || uiMode.isEmpty()) {
boolean isUserAdmin = loggedUser != null && loggedUser.isAdmin();
uiMode = isUserAdmin ? UI_ADMIN_MODE : UI_USER_MODE;
}
if (cs.isDataObject(myPath)) {
logger.info("redirect to info page");
StringBuilder sb = new StringBuilder();
sb.append("redirect:/collectionInfo?path=");
sb.append(URLEncoder.encode(myPath));
return sb.toString();
}
logger.info("is collection...continue to collection management");
if (uiMode.equals(UI_USER_MODE)) {
model.addAttribute("homePath", cs.getHomeDirectyForCurrentUser());
model.addAttribute("publicPath", cs.getHomeDirectyForPublic());
}
model.addAttribute("uiMode", uiMode);
model.addAttribute("currentPath", currentPath);
model.addAttribute("encodedCurrentPath", URLEncoder.encode(currentPath));
model.addAttribute("parentPath", parentPath);
model.addAttribute("resources", resourceService.findAll());
model.addAttribute("overwriteFileOption", loggedUser != null && loggedUser.isForceFileOverwriting());
} catch (JargonException | DataGridException e) {
logger.error("error establishing collection location", e);
model.addAttribute("unexpectedError", true);
}
logger.info("displaying collections/collectionManagement");
return "collections/collectionManagement";
}
use of com.emc.metalnx.core.domain.entity.DataGridUser in project metalnx-web by irods-contrib.
the class FileOperationsController method emptyTrash.
@RequestMapping(value = "emptyTrash/", method = RequestMethod.POST)
public ResponseEntity<String> emptyTrash() throws DataGridConnectionRefusedException, JargonException {
String trashForCurrentPath = collectionService.getTrashForPath(browseController.getCurrentPath());
DataGridUser loggedUser = loggedUserUtils.getLoggedDataGridUser();
if (fileOperationService.emptyTrash(loggedUser, trashForCurrentPath)) {
return new ResponseEntity<>(HttpStatus.OK);
}
return new ResponseEntity<>(HttpStatus.METHOD_NOT_ALLOWED);
}
use of com.emc.metalnx.core.domain.entity.DataGridUser in project metalnx-web by irods-contrib.
the class MetadataController method index.
@RequestMapping(value = "/")
public String index(final Model model, final HttpServletRequest request, @RequestParam(value = "backFromCollections", required = false) final boolean backFromCollections) throws DataGridException {
DataGridUser loggedUser = loggedUserUtils.getLoggedDataGridUser();
String uiMode = (String) request.getSession().getAttribute("uiMode");
if (uiMode == null || uiMode.isEmpty()) {
if (loggedUser.isAdmin()) {
uiMode = UI_ADMIN_MODE;
} else {
uiMode = UI_USER_MODE;
model.addAttribute("homePath", collectionService.getHomeDirectyForCurrentUser());
model.addAttribute("publicPath", collectionService.getHomeDirectyForPublic());
}
}
if (backFromCollections) {
model.addAttribute("jsonMetadataSearch", jsonMetadataSearch);
}
model.addAttribute("uiMode", uiMode);
model.addAttribute("topnavHeader", headerService.getheader("search"));
return "metadata/metadataDisplay";
}
use of com.emc.metalnx.core.domain.entity.DataGridUser in project metalnx-web by irods-contrib.
the class PreferencesController method index.
@RequestMapping(value = "/")
public String index(final Model model, final HttpServletRequest request) {
logger.info("index()");
DataGridUser loggedUser = loggedUserUtils.getLoggedDataGridUser();
String locale = loggedUser.getLocale();
String uiMode = (String) request.getSession().getAttribute("uiMode");
if (uiMode == null || uiMode.isEmpty()) {
if (loggedUser.isAdmin()) {
uiMode = UI_ADMIN_MODE;
} else {
uiMode = UI_USER_MODE;
}
}
UserPreferences userPreferences = new UserPreferences();
userPreferences.setLocaleLanguage(locale);
userPreferences.setForceFileOverwriting(loggedUser.isForceFileOverwriting());
userPreferences.setAdvancedView(loggedUser.isAdvancedView());
model.addAttribute("preferences", userPreferences);
model.addAttribute("uiMode", uiMode);
model.addAttribute("topnavHeader", headerService.getheader("prefrences"));
return "preferences/index";
}
Aggregations