/// <summary> /// 获得权限范围用户ID /// </summary> /// <param name="operators">当前登陆用户信息</param> /// <param name="isWrite">可写入</param> /// <returns></returns> public string GetDataAuthorUserId(OperatorEntity operators, bool isWrite = false) { string res = string.Empty; IDbTransaction tran = null; Logger(this.GetType(), "GetDataAuthorUserId-获得权限范围用户ID", () => { using (var conn = this.BaseRepository().GetBaseConnection()) { tran = conn.BeginTransaction(); string authorSql = authorizeService.GetDataAuthor(operators, isWrite); if (string.IsNullOrEmpty(authorSql)) { res = ""; } List <UserEntity> userList = this.BaseRepository().FindList <UserEntity>(conn, authorSql, tran).ToList(); StringBuilder user = new StringBuilder(""); foreach (UserEntity item in userList) { user.Append(item.Id); user.Append(","); } res = user.ToString(); tran.Commit(); } }, e => { Trace.WriteLine(e.Message); }); return(res); }
/// <summary> /// 获得可读数据权限范围SQL /// </summary> /// <param name="operators">当前登陆用户信息</param> /// <param name="isWrite">可写入</param> /// <returns></returns> public string GetDataAuthor(OperatorEntity operators, bool isWrite = false) { return(authorizeService.GetDataAuthor(operators, isWrite)); }