📄 userprofile.java
字号:
package com.ebusiness.ebank.security;/** * <p>Title: </p> * <p>Description: This class contains all information for a user, including * user's basic information and security constraint information. It's * the only object the client needs to know regarding a user and it's * security constraints. * * The class provides read-only methods to the caller, and the information * on the object cannot be updated once the object has been created. </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author unascribed * @version 1.0 */import java.util.Date;public class UserProfile implements java.io.Serializable{ private String[] userRoles; //One user might have multiple roles private String userID; private String language; private Date creationTime; //The time when the UserProfile is created public UserProfile() { creationTime = new Date(); } public UserProfile(String userID, String language, String[] roles) { this.userRoles = roles; this.userID = userID; this.language = language; creationTime = new Date(); } protected Date getCreationDate() { return this.creationTime; } public String getUserID() { return this.userID; } //Support multiple roles public String[] getUserRoles() { return this.userRoles; } //The ISO language code of the language the user prefers to use public String getUserLanguagePreference() { return this.language; } public String getUserOffice() { return "eBusiness-Toronto"; } /** * This method should be used on audit purpose. */ public String getUserCompany() { return "eBusiness Inc."; } /** * To determine if the user is restricted on the specified function. * * Functions class provides all of the possible functions for the application. Always use * Functions class to locate a function when calling this method */ public boolean isUserRestrictedOnFunction(String functionName) { return FunctionConstraint.isRestrictedAccessOnFunction(functionName, this.userRoles); } /** * To determine if the user is restricted on the specified database table column. * * Columns class provides all of the possible table columns for the application. Always use * Columns class to locate a column when calling this method */ public boolean isUserRestrictedOnColumn(String columnName) { return ColumnConstraint.isRestrictedAccessOnColumn(columnName, this.userRoles); } /** * To determine if the user is restricted for edit on the specified database table column. * * Columns class provides all of the possible table columns for the application. Always use * Columns class to locate a column when calling this method */ public boolean isUserRestrictedForEditOnColumn(String columnName) { return ColumnConstraint.isRestrictedEditOnColumn(columnName, this.userRoles); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -