/// <summary> /// 同步角色下的用户权限 /// </summary> /// <param name="menus">要同步的菜单权限</param> private void SetPersmissionByRole(List <MyTreeNode> menus) { int roleID = Convert.ToInt32(Request.QueryString["id"]); //角色下的用户ID,已“,”分隔 string users = LoginDataLimitManager.GetUsersByRole(roleID); if (users != string.Empty) { string[] usersArr = users.Split(','); //删除用户权限 for (int i = 0; i < usersArr.Length; i++) { LoginUserLimitManager.DeleteLoginLimitByUser(int.Parse(usersArr[i])); } LoginUserLimit userLimit = new LoginUserLimit(); //添加用户权限 for (int i = 0; i < usersArr.Length; i++) { for (int j = 0; j < menus.Count(); j++) { LoginUserLimitManager.InsertUserLimt(usersArr[i], menus[j].Id.ToString()); } } } }
/// <summary> /// 根据角色绑定用户信息 /// </summary> /// <param name="roleID">角色ID</param> private void RpUserListBindData(int roleID) { string userIDs = LoginDataLimitManager.GetUsersByRole(roleID); if (string.IsNullOrWhiteSpace(userIDs)) { return; } string strWhere = string.Format("id in ({0})", userIDs); DataTable dtUser = LoginInfoManager.getList(strWhere); RpUserList.DataSource = dtUser; RpUserList.DataBind(); }