@Secured({SECURITY_ROLE_PREFIX + SECURITY_ROLE_ADMIN}) @ApiOperation(value = "Retrieves all users' settings. Only users that are part of " + "the \"ROLE_ADMIN\" role are allowed to get all user settings.") @ApiResponses(value = {@ApiResponse(message = "List of all user settings", code = 200), @ApiResponse(message = "The current user does not have permission to get all user settings", code = 403)}) @RequestMapping(value = "/settings/all", method = RequestMethod.GET) ResponseEntity<Map<String, AlertsUIUserSettings>> findAll() throws RestException { return new ResponseEntity<>(alertsUIService.findAllAlertsUIUserSettings(), HttpStatus.OK); }
@Secured({SECURITY_ROLE_PREFIX + SECURITY_ROLE_ADMIN}) @ApiOperation(value = "Deletes a user's settings. Only users that are part of " + "the \"ROLE_ADMIN\" role are allowed to delete user settings.") @ApiResponses(value = {@ApiResponse(message = "User settings were deleted", code = 200), @ApiResponse(message = "The current user does not have permission to delete user settings", code = 403), @ApiResponse(message = "User settings could not be found", code = 404)}) @RequestMapping(value = "/settings/{user}", method = RequestMethod.DELETE) ResponseEntity<Void> delete( @ApiParam(name = "user", value = "The user whose settings will be deleted", required = true) @PathVariable String user) throws RestException { if (alertsUIService.deleteAlertsUIUserSettings(user)) { return new ResponseEntity<>(HttpStatus.OK); } else { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } } }
@Secured({"ROLE_ADMIN"}) @RequestMapping(value = "/internalapi/migration/url", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public MigrationResult migrateFromUrl(@RequestParam(name = "baseurl") String oldHydraBaseUrl, @RequestParam(name = "doMigrateDatabase") boolean doMigrateDatabase) throws IOException { messages.clear(); return migration.migrateFromUrl(oldHydraBaseUrl, doMigrateDatabase, true); }
/** * Gets the details of a previously submitted job. <p>Requires READ permission on namespace</p> * * @param id the job id. * * @return the job information. */ @RequestMapping(value = "/jobs/ids/{id}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_JOBS_GET_BY_ID) public Job getJob(@PathVariable("id") String id, @RequestParam(value = "verbose", required = false, defaultValue = "false") Boolean verbose) throws Exception { return jobService.getJob(id, verbose); }
@RequestMapping(value = "/processDefinition/{flowId}/scheduler", method = RequestMethod.GET) @Secured(ConsoleSecurityRoles.ROLE_PROCESS_VIEW) public String redirectToScheduleView(@PathVariable String flowId, Model model) { return "redirect:/scheduler/" + flowId; }
@Secured({"ROLE_ADMIN"}) @RequestMapping(value = "/internalapi/backup/restorefile", method = RequestMethod.POST) public GenericResponse restoreFromUpload(@RequestParam("file") MultipartFile file) throws Exception { return backup.restoreFromFile(file.getInputStream()); }
@Secured("IS_AUTHENTICATED_FULLY") @RequestMapping(path = "/whoami/roles", method = RequestMethod.GET) public List<String> user() { UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext(). getAuthentication().getPrincipal(); return userDetails.getAuthorities().stream().map(ga -> ga.getAuthority()).collect(Collectors.toList()); } }
@Secured(Authorities.ADMIN_ROLE) @RequestMapping(value = "/{groupId}/nodes", method = POST) public void createGroupByNodeList(@PathVariable("groupId") String groupId, @RequestParam(value = "nodes") List<String> nodes) { this.discoveryStorage.getOrCreateGroup(new DefaultNodesGroupConfig(groupId, "list:" + String.join(", ", nodes))); }
@Secured({"ROLE_ADMIN"}) @RequestMapping(value = "/internalapi/indexer/checkCapsMessages/{indexerName}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Collection<String> getCheckerMessages(@PathVariable String indexerName) { return multimap.get(indexerName); }
@Secured({"ROLE_ADMIN"}) @RequestMapping(value = "/internalapi/debuginfos/downloadlog", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public FileSystemResource downloadLogFile(@RequestParam String logfilename) { File file = new File(new File(NzbHydra.getDataFolder(), "logs"), logfilename); return new FileSystemResource(file); }
@RequestMapping(value = "/internalapi/askadmin", method = RequestMethod.GET) @Secured({"ROLE_ADMIN"}) public String askForAdmin(HttpSession session, Principal principal) { return "index"; }
@Secured(Authorities.ADMIN_ROLE) @RequestMapping(value = "/{groupId}/filter", method = POST) public void createGroupByFilter(@PathVariable("groupId") String groupId, @RequestParam(value = "filter") String filter) { this.discoveryStorage.getOrCreateGroup(new DefaultNodesGroupConfig(groupId, filter)); }
@RequestMapping(value = "/internalapi/nfo/{guid}", produces = MediaType.APPLICATION_JSON_VALUE) @Secured({"ROLE_USER"}) public NfoResult getNfo(@PathVariable("guid") long guid) throws IndexerAccessException { return fileHandler.getNfo(guid); }
@Secured({"ROLE_ADMIN"}) @RequestMapping(value = "/internalapi/migration/files", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public MigrationResult migrateFromFiles(@RequestParam(name = "settingsCfgFile") String settingsFile, @RequestParam(name = "dbFile", required = false) String dbFile, @RequestParam(name = "doMigrateDatabase") boolean doMigrateDatabase) throws IOException { messages.clear(); return migration.migrateFromFiles(settingsFile, dbFile, doMigrateDatabase); }
@Secured({"ROLE_ADMIN"}) @RequestMapping(value = "/internalapi/updates/changesSince", method = RequestMethod.GET) public List<ChangelogVersionEntry> getChangesSince() throws Exception { return updateManager.getChangesSinceCurrentVersion(); }
@RequestMapping(value = "internalapi/help/{section}", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE) @Secured({"ROLE_ADMIN"}) public String askForAdmin(@PathVariable String section) throws Exception { String markdown = Resources.toString(Resources.getResource(HelpWeb.class, ("/help/" + section + ".md").toLowerCase()), Charsets.UTF_8); return Markdown.renderMarkdownAsHtml(markdown); }
@Secured({"ROLE_USER"}) @RequestMapping(value = "/internalapi/search/state", produces = MediaType.APPLICATION_JSON_VALUE) public SearchState getSearchState(@RequestParam("searchrequestid") long searchRequestId) { return searchStates.getOrDefault(searchRequestId, new SearchState()); }
@Secured({"ROLE_ADMIN"}) @RequestMapping(value = "/internalapi/updates/versionHistory", method = RequestMethod.GET) public List<ChangelogVersionEntry> getVersionHistory() throws Exception { return updateManager.getCurrentVersionChanges(); }
@Secured({"ROLE_STATS"}) @RequestMapping(value = "/internalapi/history/searches/details/{searchId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public SearchDetails searchHistoryDetails(@PathVariable int searchId) { return history.getSearchDetails(searchId); }
@Secured({"ROLE_ADMIN"}) @RequestMapping(value = "/internalapi/updates/ignore", method = RequestMethod.PUT, consumes = MediaType.ALL_VALUE) public void ignore(@RequestParam("version") String version) throws Exception { updateManager.ignore(version); }