// list acls I share to other public List <CACLEntity> ListMyAcls() { String filter = "this.Acl_Creator=" + Usr_Id.ToString(); List <CACLEntity> userAcls = new CACLEntity(ConnString).GetObjectList(filter); return(userAcls); }
public List <CACLEntity> GetUserACLs() { String filter = "this.Acl_Role=" + Usr_Id.ToString(); filter += " and this.Acl_RType=" + ((int)ACLROLETYPE.USERROLE).ToString(); List <CACLEntity> userAcls = new CACLEntity(ConnString).GetObjectList(filter); return(userAcls); }
public List <CACLEntity> ListMyAcls(int sharedResource) { String filter = "this.Acl_Creator=" + Usr_Id.ToString(); filter += " and this.Acl_Resource=" + sharedResource.ToString(); List <CACLEntity> userAcls = new CACLEntity(ConnString).GetObjectList(filter); return(userAcls); }
public bool CheckPrivilege(CACLEntity acl) { // system admin has all privileges if (Usr_Type == (int)USERTYPE.SYSTEMADMIN) { return(true); } // if resourceid of acl is 0, it's a system management // and no users have the privilege except system admin if (acl.Acl_Resource == 0) { return(false); } // if resourceid is the organize id of current user, // the user must be system admin if (acl.Acl_Resource == this.Usr_Organize) { if (this.Usr_Type == (int)USERTYPE.ORGANIZEADMIN) { return(true); } else { return(false); } } // get all groups containing current user String filter = "this.Urg_User="******"this.Acl_Operation=" + acl.Acl_Operation.ToString(); filter += " and this.Acl_Resource=" + resId.ToString(); filter += " and this.Acl_Role=" + Usr_Id.ToString(); filter += " and this.Acl_RType=" + ((int)ACLROLETYPE.USERROLE).ToString(); List <CACLEntity> acls = acl.GetObjectList(filter); if (acls.Count > 0) { return(true); } // check if user's groups have right on this resource foreach (CUserGroupEntity ug in userGroups) { filter = "this.Acl_Operation=" + acl.Acl_Operation.ToString(); filter += " and this.Acl_Resource=" + resId.ToString(); filter += " and this.Acl_Role=" + ug.Urg_Group.ToString(); filter += " and this.Acl_RType=" + ((int)ACLROLETYPE.GROUPROLE).ToString(); acls = acl.GetObjectList(filter); if (acls.Count > 0) { return(true); } } // get parent id of this resource CResourceEntity resource = new CResourceEntity(ConnString).Load(resId); if (resource == null) { break; } else { resId = resource.Res_Parent; } } return(false); }