Revision 57650
Added by Michele Artini over 4 years ago
UserInfo.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
public static boolean isSuperUser(final Authentication authentication) { |
44 | 44 |
for (final GrantedAuthority aut : authentication.getAuthorities()) { |
45 |
|
|
46 | 45 |
if (aut.getAuthority().equals("ROLE_" + OpenOrgsConstants.superUserRole)) { return true; } |
47 | 46 |
} |
48 | 47 |
return false; |
49 | 48 |
} |
50 | 49 |
|
50 |
public static boolean isSimpleUser(final Authentication authentication) { |
|
51 |
for (final GrantedAuthority aut : authentication.getAuthorities()) { |
|
52 |
if (aut.getAuthority().equals("ROLE_" + OpenOrgsConstants.userRole)) { return true; } |
|
53 |
} |
|
54 |
return false; |
|
55 |
} |
|
56 |
|
|
57 |
public static boolean isPending(final Authentication authentication) { |
|
58 |
for (final GrantedAuthority aut : authentication.getAuthorities()) { |
|
59 |
if (aut.getAuthority().equals("ROLE_" + OpenOrgsConstants.pendingRole)) { return true; } |
|
60 |
} |
|
61 |
return false; |
|
62 |
} |
|
63 |
|
|
64 |
public static boolean isNotAuthorized(final Authentication authentication) { |
|
65 |
for (final GrantedAuthority aut : authentication.getAuthorities()) { |
|
66 |
if (aut.getAuthority().equals("ROLE_" + OpenOrgsConstants.notAuthorizedRole)) { return true; } |
|
67 |
} |
|
68 |
return false; |
|
69 |
} |
|
70 |
|
|
51 | 71 |
} |
Also available in: Unified diff
new registration form