content: package org.zeus.bean;
  
  import com.fasterxml.jackson.annotation.JsonIgnore;
  import com.fasterxml.jackson.annotation.JsonInclude;
  import lombok.Data;
  import org.springframework.security.core.GrantedAuthority;
  import org.springframework.security.core.authority.SimpleGrantedAuthority;
  import org.springframework.security.core.userdetails.UserDetails;
  
  import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.Date;
  import java.util.List;
  
  @Data
  @JsonInclude(JsonInclude.Include.NON_NULL)
  public class User extends UserBase implements UserDetails, Serializable {
      private Long id;
  
      private String username;
  
      private String name;
  
      private String email;
  
      private String password;
  
      private String lastLogin;
  
      private String createdTime;
  
      private String accountStatus;
  
      private String photo;
  
      private String deletedflag;
  
      private Integer mobile;
  
      private Date updateTime;
      private List<Role> roles;
  
      private static final long serialVersionUID = 1L;
  
      @JsonIgnore
      @Override
      public Collection<? extends GrantedAuthority> getAuthorities() {
          List<GrantedAuthority> authorities = new ArrayList<>();
          for (Role role : roles) {
              authorities.add(new SimpleGrantedAuthority(role.getName()));
          }
          // authorities.add(new SimpleGrantedAuthority("ROLE_dean"));
          return authorities;
      }
  
      @JsonIgnore
      @Override
      public boolean isEnabled() {
          return true;
      }
  
      @JsonIgnore
      @Override
      public String getUsername() {
          return name;
      }
  
  
      @JsonIgnore
      @Override
      public String getPassword() {
          return password;
      }
  
      @Override
      public boolean isAccountNonExpired() {
          return true;
      }
  
      @Override
      public boolean isAccountNonLocked() {
          return true;
      }
  
      @Override
      public boolean isCredentialsNonExpired() {
          return true;
      }
  
  }