@Override
 @JsonIgnore
 public Collection<? extends GrantedAuthority> getAuthorities() {
   Set<Role> roles = this.getRoles();
   if (roles == null) {
     return Collections.emptyList();
   }
   Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();
   for (Role role : roles) {
     authorities.add(new SimpleGrantedAuthority(role.name()));
   }
   return authorities;
 }
Beispiel #2
0
 @Override
 public Collection<? extends GrantedAuthority> getAuthorities() {
   /*
           Set<String> roles = this.getRoles();
           if (roles == null) {
               return Collections.emptyList();
           }
   */
   Set<GrantedAuthority> authorities = new HashSet<>();
   for (Role role : roles) {
     authorities.add(new SimpleGrantedAuthority(role.toString()));
   }
   return authorities;
 }
Beispiel #3
0
  @Transient
  @JsonIgnore
  public Collection<? extends GrantedAuthority> getAuthorities() {

    if (authorities.isEmpty()) {

      for (Role role : roles) {

        String[] rights = role.getRights().split(";");

        for (String right : rights) {

          if (NullEmptyChecker.isNotNullOrEmpty(right)) {
            authorities.add(new SimpleGrantedAuthority("ROLE_" + right));
          }
        }
      }
    }
    return authorities;
  }
 @Override
 public String toString() {
   return "RoleResourcePermission{id="
       + this.getId()
       + ",roleId="
       + (role != null ? role.getId() : "null")
       + ", resourceId="
       + resourceId
       + ", permissionIds="
       + permissionIds
       + '}';
 }
Beispiel #5
0
 @Override
 public Collection<? extends GrantedAuthority> getAuthorities() {
   List<GrantedAuthority> authorities = new ArrayList<>();
   authorities.add(new SimpleGrantedAuthority(role.getName()));
   return authorities;
 }