moved the isSecretaryOrAdmin method
This commit is contained in:
@ -4,6 +4,7 @@ import org.springframework.stereotype.Service;
|
||||
import ovh.herisson.Clyde.EndPoints.LoginController;
|
||||
import ovh.herisson.Clyde.Repositories.InscriptionRepository;
|
||||
import ovh.herisson.Clyde.Tables.InscriptionRequest;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.Token;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
@ -39,4 +40,17 @@ public class AuthenticatorService {
|
||||
public void register(InscriptionRequest inscriptionRequest) {
|
||||
inscriptionService.save(inscriptionRequest);
|
||||
}
|
||||
|
||||
|
||||
public boolean isNotSecretaryOrAdmin(String authorization){
|
||||
if (authorization ==null)
|
||||
return true;
|
||||
|
||||
User poster = getUserFromToken(authorization);
|
||||
if (poster == null) return true;
|
||||
|
||||
return poster.getRole() != Role.Secretary || poster.getRole() != Role.Admin;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user