/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ro.nextreports.server.domain; import java.util.Collection; import java.util.Collections; import org.jcrom.annotations.JcrProperty; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; /** * @author Decebal Suiu */ public class User extends Entity implements UserDetails { private static final long serialVersionUID = 1L; @JcrProperty private String password; @JcrProperty private boolean admin; @JcrProperty private boolean enabled = true; @JcrProperty private boolean accountExpired; @JcrProperty private boolean accountLocked; @JcrProperty private boolean credentialsExpired; @JcrProperty private String email; @JcrProperty private String realName; @JcrProperty private String realm; @JcrProperty private String profile; public User() { super(); setProfile("analyst"); // default profile to view all sections } public User(String name, String path) { super(name, path); } public String getUsername() { return getName(); } public void setUsername(String username) { setName(username); } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public boolean isAdmin() { return admin; } public void setAdmin(boolean admin) { this.admin = admin; } public Collection<GrantedAuthority> getAuthorities() { return Collections.emptyList(); } public boolean isAccountNonExpired() { return !accountExpired; } public boolean isAccountNonLocked() { return !accountLocked; } public boolean isCredentialsNonExpired() { return !credentialsExpired; } public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public boolean isAccountExpired() { return accountExpired; } public void setAccountExpired(boolean accountExpired) { this.accountExpired = accountExpired; } public boolean isAccountLocked() { return accountLocked; } public void setAccountLocked(boolean accountLocked) { this.accountLocked = accountLocked; } public boolean isCredentialsExpired() { return credentialsExpired; } public void setCredentialsExpired(boolean credentialsExpired) { this.credentialsExpired = credentialsExpired; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getRealName() { return realName; } public void setRealName(String realName) { this.realName = realName; } public String getRealm() { return realm; } public void setRealm(String realm) { this.realm = realm; } public String getProfile() { return profile; } public void setProfile(String profile) { this.profile = profile; } }