This commit is contained in:
parent
e0143ab27e
commit
20f7a1da77
|
@ -21,6 +21,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
|||
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||
|
||||
import eu.dnetlib.organizations.controller.UserInfo;
|
||||
import eu.dnetlib.organizations.controller.UserRole;
|
||||
import eu.dnetlib.organizations.utils.OpenOrgsConstants;
|
||||
|
||||
@Profile("dev")
|
||||
|
@ -92,7 +93,7 @@ public class MockSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
.usersByUsernameQuery("select ?, '{MD5}" + DigestUtils.md5Hex(DEFAULT_PASSWORD) + "', true")
|
||||
.authoritiesByUsernameQuery("with const as (SELECT ? as email) "
|
||||
+ "select c.email, 'ROLE_" + OpenOrgsConstants.OPENORGS_ROLE_PREFIX + "'||coalesce(u.role, '"
|
||||
+ OpenOrgsConstants.NOT_AUTORIZED_ROLE
|
||||
+ UserRole.NOT_AUTHORIZED
|
||||
+ "') from const c left outer join users u on (u.email = c.email)");
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,11 @@ public class HomeController extends AbstractDnetController {
|
|||
return authentication != null ? UserInfo.getEmail(authentication) : null;
|
||||
}
|
||||
|
||||
@ModelAttribute("role")
|
||||
public UserRole getUserRole(final Authentication authentication) {
|
||||
return authentication != null ? UserInfo.findRole(authentication) : null;
|
||||
}
|
||||
|
||||
@ModelAttribute("fullname")
|
||||
public String getUserFullname(final Authentication authentication) {
|
||||
return authentication != null ? UserInfo.getFullname(authentication) : null;
|
||||
|
|
|
@ -42,6 +42,7 @@ public class UserInfo {
|
|||
}
|
||||
|
||||
public static UserRole findRole(final Authentication authentication) {
|
||||
|
||||
return authentication.getAuthorities()
|
||||
.stream()
|
||||
.map(GrantedAuthority::getAuthority)
|
||||
|
|
|
@ -50,23 +50,31 @@
|
|||
</p>
|
||||
|
||||
<form class="small">
|
||||
<div class="form-group">
|
||||
<label>Fullname</label>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">Fullname</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" readonly class="form-control-plaintext" th:value="${fullname}" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Organization</label>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">Organization</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" readonly class="form-control-plaintext" th:value="${organization}" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Reference person</label>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">Reference person</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" ng-model="referencePerson">
|
||||
<small class="form-text text-muted">Please indicate your reference person (if available)</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Request message</label>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">Request message</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" ng-model="requestMessage" cols="4"></textarea>
|
||||
<small class="form-text text-muted">Specify the reasons for your request</small>
|
||||
<small class="form-text text-muted">Specify the reason of your request</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" style="margin-top: 25px">
|
||||
|
|
Loading…
Reference in New Issue