/// <summary> /// 将一个目录的访问权限赋给对象 /// </summary> /// <param name="pageId">页面ID</param> /// <param name="forId">要复制到的对象ID</param> /// <param name="btnRights">按钮权限</param> /// <param name="updateWhenExists">对象已经有权限时,是否更新</param> public bool AddRole(int pageId, IList<int> forId, string btnRights, bool updateWhenExists) { int[] adminIDsInt = forId.ToArray(); if (adminIDsInt.Length > 0) { int result = new DR_AdminRight().AddOrUpdate(pageId, btnRights, updateWhenExists, adminIDsInt); if (result == 0) return false; return true; } return false; }
/// <summary> /// 批量更新权限 /// </summary> /// <param name="aids">管理员ID数组</param> /// <param name="info">权限集合</param> public bool UpdateRights(string aidsStr, Dictionary<int, string> info) { string[] aids = aidsStr.Split(','); int[] adminIDsInt = new int[aids.Length]; if (aids.Length > 0) { for (int i = 0; i < aids.Length; i++) { adminIDsInt[i] = Convert.ToInt32(aids[i]); } int result = new DR_AdminRight().UpdateRights(adminIDsInt, info); if (result == 0) return false; return true; } return false; }