This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit 2c821a1b authored by Eduard Frankford's avatar Eduard Frankford
Browse files

fix user edit bug

parent de6f8759
2 merge requests!188Merging Peer Reviewing et. al to Master,!164211 peer reviewing functionality
......@@ -107,7 +107,7 @@ services:
networks:
- backend
- frontend
# sharing_elasticsearch:
# image: 'docker.elastic.co/elasticsearch/elasticsearch:7.17.6'
# container_name: sharing_elasticsearch
......
......@@ -319,11 +319,7 @@ public class UserService {
@Transactional(readOnly = true)
public Optional<User> getUserWithAuthoritiesByLogin(String login) {
String currentUser = SecurityUtils.getCurrentUserLogin().orElse(null);
if (currentUser != null && currentUser.equals(login)) {
return userRepository.findOneWithAuthoritiesByLogin(login);
}
return Optional.empty();
return userRepository.findOneWithAuthoritiesByLogin(login);
}
@Transactional(readOnly = true)
......
......@@ -214,7 +214,7 @@ public class UserResource {
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the "login" user, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/users/{login}")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.USER + "\")")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<AdminUserDTO> getUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) {
log.debug("REST request to get User : {}", login);
return ResponseUtil.wrapOrNotFound(userService.getUserWithAuthoritiesByLogin(login).map(AdminUserDTO::new));
......
......@@ -86,16 +86,16 @@ spring:
client:
provider:
oidc:
issuer-uri: https://keycloak.sharing-codeability.uibk.ac.at/auth/realms/gitsearch
issuer-uri: https://keycloak.codeability-austria.uibk.ac.at/auth/realms/gitsearch
registration:
oidc:
client-id: ${OIDC_KEYCLOAK_CLIENTID}
client-secret: ${OIDC_KEYCLOAK_SECRET}
scope: openid,profile,email
# gitlabOidc:
# client-id: ${GITLAB_OIDC_CLIENTID}
# client-secret: ${GITLAB_OIDC_CLIENT_SECRET}
# scope: api,read_user,read_api,read_repository,write_repository,read_registry,write_registry,sudo,openid,profile,email
# gitlabOidc:
# client-id: ${GITLAB_OIDC_CLIENTID}
# client-secret: ${GITLAB_OIDC_CLIENT_SECRET}
# scope: api,read_user,read_api,read_repository,write_repository,read_registry,write_registry,sudo,openid,profile,email
server:
port: 8080
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment