Project

General

Profile

« Previous | Next » 

Revision 61371

1. changed user roles defined in the project to authorities given by the aai.
2. created method returning user roles with desired status (active, deleted).

View differences:

PiWikController.java
42 42

  
43 43
    @RequestMapping(value = "/getPiwikSiteForRepo/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
44 44
    @ResponseBody
45
    @PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#repositoryId) or (@repositoryService.getRepositoryById(#repositoryId).registeredBy=='null' and hasRole('ROLE_USER'))")
45
    @PreAuthorize("hasAnyRole('SUPER_ADMINISTRATOR', 'CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or @authorizationService.isMemberOf(#repositoryId) or (@repositoryService.getRepositoryById(#repositoryId).registeredBy=='null' and hasAuthority('REGISTERED_USER'))")
46 46
    public PiwikInfo getPiwikSiteForRepo(@PathVariable("repositoryId") String repositoryId) {
47 47
        return piWikService.getPiwikSiteForRepo(repositoryId);
48 48
    }
49 49

  
50 50
    @RequestMapping(value = "/savePiwikInfo" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
51
    @PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#piwikInfo.repositoryId) or (@repositoryService.getRepositoryById(#piwikInfo.repositoryId).registeredBy=='null' and hasRole('ROLE_USER'))")
51
    @PreAuthorize("hasAnyRole('SUPER_ADMINISTRATOR', 'CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or @authorizationService.isMemberOf(#piwikInfo.repositoryId) or (@repositoryService.getRepositoryById(#piwikInfo.repositoryId).registeredBy=='null' and hasAuthority('REGISTERED_USER'))")
52 52
    public PiwikInfo savePiwikInfo(@RequestBody PiwikInfo piwikInfo) {
53 53
        return piWikService.savePiwikInfo(piwikInfo);
54 54
    }
......
150 150

  
151 151
    @RequestMapping(value = "/approvePiwikSite/{repositoryId}" , method = RequestMethod.GET)
152 152
    @ResponseBody
153
    @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN')")
153
    @PreAuthorize("hasAuthority('SUPER_ADMINISTRATOR') or hasAuthority('CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR')")
154 154
    public ResponseEntity<Object> approvePiwikSite(@PathVariable("repositoryId") String repositoryId) {
155 155
        return piWikService.approvePiwikSite(repositoryId);
156 156
    }
157 157

  
158 158
    @RequestMapping(value = "/getOpenaireId/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
159 159
    @ResponseBody
160
    @PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_PROVIDE_ADMIN') or @authorizationService.isMemberOf(#repositoryId) or (@repositoryService.getRepositoryById(#repositoryId).registeredBy=='null' and hasRole('ROLE_USER'))")
160
    @PreAuthorize("hasAnyRole('SUPER_ADMINISTRATOR', 'CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or @authorizationService.isMemberOf(#repositoryId) or (@repositoryService.getRepositoryById(#repositoryId).registeredBy=='null' and hasAuthority('REGISTERED_USER'))")
161 161
    public String getOpenaireId(@PathVariable("repositoryId") String repositoryId){
162 162
        return piWikService.getOpenaireId(repositoryId);
163 163
    }
......
165 165
    @RequestMapping(value = "/markPiwikSiteAsValidated/{repositoryId}" , method = RequestMethod.POST,
166 166
            consumes = MediaType.APPLICATION_JSON_VALUE)
167 167
    @ResponseBody
168
    @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN')")
168
    @PreAuthorize("hasAuthority('SUPER_ADMINISTRATOR') or hasAuthority('CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR')")
169 169
    public ResponseEntity<Object> markPiwikSiteAsValidated(@PathVariable("repositoryId") String repositoryId) throws RepositoryServiceException {
170 170
        return piWikService.markPiwikSiteAsValidated(repositoryId);
171 171
    }
172 172

  
173 173
    @RequestMapping(value = "/enableMetricsForRepository", method = RequestMethod.POST,
174 174
            consumes = MediaType.APPLICATION_JSON_VALUE)
175
    @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_PROVIDE_ADMIN') or (hasRole('ROLE_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)")
175
    @PreAuthorize("hasAuthority('SUPER_ADMINISTRATOR') or hasAuthority('CONTENT_PROVIDER_DASHBOARD_ADMINISTRATOR') or (hasAuthority('REGISTERED_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)")
176 176
    public PiwikInfo enableMetricsForRepository(@RequestParam("officialName") String officialName,
177 177
                                                @RequestParam("repoWebsite") String repoWebsite,
178 178
                                                @RequestBody PiwikInfo piwikInfo) throws RepositoryServiceException {

Also available in: Unified diff