|
package com.ekexiu.console.system.vo;
import org.jfw.util.auth.AuthUser;
import org.jfw.util.auth.AuthUtil;
import com.ekexiu.console.system.po.User;
public class ConsoleAuthUser implements AuthUser {
private String id;
private String name;
private String head;
private transient int[] auths;
public ConsoleAuthUser() {
}
public ConsoleAuthUser(User user) {
this.id = user.getId();
this.name = user.getName();
this.head = user.getHead();
//this.auths = AuthUtil.deSerialAuth(user.getAuthinfo());
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getHead() {
return head;
}
public void setHead(String head) {
this.head = head;
}
public int[] getAuths() {
return auths;
}
public void setAuths(int[] auths) {
this.auths = auths;
}
public boolean hasAuthority(int auth) {
return auth ==0 || ( this.auths != null && AuthUtil.hasAuthority(this.auths, auth));
}
public static void main(String[] args) throws Exception {
ConsoleAuthUser user = new ConsoleAuthUser();
user.setId("aaa");
user.setName("dfsafas");
user.setHead("=========");
user.setAuths(new int[8]);
System.out.println(org.jfw.util.json.JsonService.toJson(user));
}
}
|