1 16 package dlog4j.security; 17 18 import java.io.IOException ; 19 20 import org.xml.sax.SAXException ; 21 22 import web.security.Operation; 23 import web.security.Privilege; 24 import web.security.Range; 25 import web.security.Resource; 26 import web.security.impl.PrivilegeImpl; 27 import web.security.impl.RoleImpl; 28 29 33 public class DlogRole extends RoleImpl { 34 35 public final static int ROLE_GUEST = 1; 36 public final static int ROLE_COMMON = 2; 37 public final static int ROLE_FRIEND = 4; 38 public final static int ROLE_BUDDY = 8; 39 public final static int ROLE_MANAGER = 16; 40 41 protected int id; 42 43 49 public void addPrivilege(String res, String opt, String rng) throws IOException , SAXException { 50 SecurityConfig sc = SecurityConfig.getConfig(); 51 Resource oRes = sc.getResourceByName(res); 52 Operation oOpt = sc.getOperationByName(opt); 53 Range oRng = sc.getRangeByName(rng); 54 Privilege pvg = new PrivilegeImpl(oRes,oOpt,oRng); 55 privileges.add(pvg); 56 } 57 58 public int getId() { 59 return id; 60 } 61 public void setId(int id) { 62 this.id = id; 63 } 64 public String toString() { 65 return "ROLE:("+id+','+name+','+desc+','+privileges.size()+')'; 66 } 67 } 68 | Popular Tags |