From 44cae6eb467d7b52e2973c154cad62decefe80ac Mon Sep 17 00:00:00 2001 From: cheng19920620 <511180749@qq.com> Date: Sat, 16 Sep 2023 10:27:07 +0800 Subject: [PATCH] =?UTF-8?q?--minio=E6=96=87=E4=BB=B6=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=92=8C=E5=9F=BA=E8=A1=A8=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MinioController/MinioApiController.cs | 50 +++++++++++-------- .../MinioController/RequstStoragePath.cs | 16 +++++- 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/IBKLinker-Minio/Controller/MinioController/MinioApiController.cs b/IBKLinker-Minio/Controller/MinioController/MinioApiController.cs index 7c2fc1a..98e6afc 100644 --- a/IBKLinker-Minio/Controller/MinioController/MinioApiController.cs +++ b/IBKLinker-Minio/Controller/MinioController/MinioApiController.cs @@ -170,7 +170,6 @@ namespace IBKLinker_Minio.Controller.MinioController } - #region minio权限表 /// /// 添加minio权限表 @@ -922,6 +921,7 @@ namespace IBKLinker_Minio.Controller.MinioController return request; } + /// /// 权限查询 /// @@ -930,37 +930,43 @@ namespace IBKLinker_Minio.Controller.MinioController /// /// [HttpPost, Route("GetEmpower")] - public bool GetEmpower(string UserID, string FileName, string EmpowerType) + public RequestEntity GetEmpower(string UserID, string FileName, string EmpowerType) { - bool Empower=false; - //用户ID,文件ID,文件操作类型(查看/移动) - using (IDbContext db = ObjectContainer.GetObject("db")) + RequestEntity request = new RequestEntity(); + try { - string sql = string.Empty; - if (!string.IsNullOrEmpty(UserID)) - { - sql += "a.USER_ID=" + UserID; - } - if (!string.IsNullOrEmpty(FileName)) - { - sql += "d.File_Name='" + FileName + "'"; - } - if (!string.IsNullOrEmpty(FileName)) + //用户ID,文件ID,文件操作类型(查看/移动) + using (IDbContext db = ObjectContainer.GetObject("db")) { - sql += "b." + EmpowerType + "=1"; - } + string sql = string.Empty; + if (!string.IsNullOrEmpty(UserID)) + { + sql += "a.USER_ID=" + UserID; + } + if (!string.IsNullOrEmpty(FileName)) + { + sql += "d.File_Name='" + FileName + "'"; + } + if (!string.IsNullOrEmpty(FileName)) + { + sql += "b." + EmpowerType + "=1"; + } - List dt = db.Query("select a.* from minio_user a left join minio_role_permission b on a.role_id=b.id left join minio_authority c on b.limits_authority_id=c.limits_authority_id left join minio_storage_path d on c.file_id=d.pk where 1=1 " + sql + " ORDER BY a.creator_time").ToList(); - if (dt.Count > 0) - { - Empower = true; + request.data = db.Query("select b.*,d.FILE_NAME,d.FILE_PATH from minio_user a left join minio_role_permission b on a.role_id=b.id left join minio_authority c on b.limits_authority_id=c.limits_authority_id left join minio_storage_path d on c.file_id=d.pk where 1=1 " + sql + " ORDER BY a.creator_time").ToList(); + request.code = "0"; } } + catch (Exception) + { + request.code = "1"; + //throw; + } + //通过用户ID查询用户得角色ID, //判断当前角色是否有操作权限 //通过角色ID查询用户有权限得文件夹 - return Empower; + return request; } #endregion #region 公用方法 diff --git a/IBKLinker-Minio/Entity/MinioController/RequstStoragePath.cs b/IBKLinker-Minio/Entity/MinioController/RequstStoragePath.cs index e8248a7..748badb 100644 --- a/IBKLinker-Minio/Entity/MinioController/RequstStoragePath.cs +++ b/IBKLinker-Minio/Entity/MinioController/RequstStoragePath.cs @@ -31,8 +31,20 @@ namespace IBKLinker_Minio.Entity.MinioController } public class RequstStoragePath: StoragePath { - - public List requstStoragePaths { get; set; } } + public class retqustUser : MinioRolePermission + { + /// + ///文件名称 + /// + [Persistent("FILE_NAME"), DisplayName("文件名称")] + public string FileName { get; set; } + + /// + ///文件路径 + /// + [Persistent("FILE_PATH"), DisplayName("文件路径")] + public string FilePate { get; set; } + } }