All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jk.webstack.security.UserRole Maven / Gradle / Ivy

/*
 * Copyright 2002-2022 Dr. Jalal Kiswani. 
 * Email: [email protected]
 * Check out https://smart-api.com for more details
 * 
 * All the opensource projects of Dr. Jalal Kiswani are free for personal and academic use only, 
 * for commercial usage and support, please contact the author.
 *
 * 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 com.jk.webstack.security;

import org.springframework.security.core.GrantedAuthority;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Data;

// TODO: Auto-generated Javadoc
/**
 * The Class UserRole.
 */
@Entity
@Table(name = "sec_roles")

/**
 * Instantiates a new user role.
 */

/**
 * Instantiates a new user role.
 */

/**
 * Instantiates a new user role.
 */

/**
 * Instantiates a new user role.
 */

/**
 * Instantiates a new user role.
 */

/**
 * Instantiates a new user role.
 */

/**
 * Instantiates a new user role.
 */
@Data
public class UserRole implements GrantedAuthority {

	/** The Constant ADMIN. */
	public static final String ADMIN = "admin";

	/** The id. */
	@Id
	@Column(name = "id")
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	Integer id;

	/** The name. */
	@Column(name = "name")
	String name;

	/**
	 * Gets the authority.
	 *
	 * @return the authority
	 */
	@Override
	public String getAuthority() {
		return getName();
	}
	
	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return name==null?name:name.toLowerCase();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy