internal List <SimpleUserInfo> getSimpleUserList() { this.getRoleID(); User user = new User(); List <SimpleUserInfo> simpleUsersByRole = user.GetSimpleUsersByRole(intRoleID); int count = simpleUsersByRole.Count; if (count <= 1) { OU ou = new OU(); foreach (OUInfo info in ou.GetOUsByRole(intRoleID)) { List <SimpleUserInfo> simpleUsersByOU = user.GetSimpleUsersByOU(info.ID); if (simpleUsersByOU.Count > 0) { simpleUsersByRole.Add(simpleUsersByOU[0]); count++; if (simpleUsersByOU.Count > 1) { simpleUsersByRole.Add(simpleUsersByOU[1]); count++; } if (count > 1) { return(simpleUsersByRole); } } } return(simpleUsersByRole); } return(simpleUsersByRole); }
internal List <int> getOULists() { this.getRoleID(); List <OUInfo> oUsByRole = new OU().GetOUsByRole(intRoleID); List <int> list2 = new List <int>(); foreach (OUInfo info in oUsByRole) { list2.Add(info.ID); } return(list2); }
public void RemoveOU(int ouID, int roleID) { this.getRoleID(); if (roleID != intRoleID) { goto Label_00E1; } User user = new User(); List <SimpleUserInfo> simpleUsersByRole = user.GetSimpleUsersByRole(intRoleID); if (simpleUsersByRole.Count >= 1) { goto Label_00E1; } simpleUsersByRole.Clear(); List <UserInfo> usersByOU = user.GetUsersByOU(ouID); if (usersByOU.Count <= 0) { goto Label_00E1; } usersByOU.Clear(); bool flag = false; List <OUInfo> oUsByRole = new OU().GetOUsByRole(intRoleID); using (List <OUInfo> .Enumerator enumerator = oUsByRole.GetEnumerator()) { while (enumerator.MoveNext()) { OUInfo current = enumerator.Current; if ((current.ID != ouID) && (user.GetSimpleUsersByOU(current.ID).Count > 0)) { goto Label_00B8; } } goto Label_00CB; Label_00B8: flag = true; } Label_00CB: oUsByRole.Clear(); if (!flag) { throw new MyException("管理员角色至少需要包含一个用户!"); } Label_00E1: this.irole_0.RemoveOU(ouID, roleID); }
public List <RoleInfo> GetRolesByUser(int userID) { List <RoleInfo> rolesByUser = this.irole_0.GetRolesByUser(userID); ArrayList list2 = new ArrayList(); foreach (RoleInfo info in rolesByUser) { list2.Add(info.ID); } OU ou = new OU(); foreach (OUInfo info2 in ou.GetOUsByUser(userID)) { foreach (RoleInfo info3 in this.irole_0.GetRolesByOU(info2.ID)) { if (list2.IndexOf(info3.ID) < 0) { rolesByUser.Add(info3); list2.Add(info3.ID); } } } return(rolesByUser); }