--minio文件权限管理和基表接口修改提交

master
程志刚 1 year ago
parent d1e152428c
commit 44cae6eb46

@ -170,7 +170,6 @@ namespace IBKLinker_Minio.Controller.MinioController
}
#region minio权限表
/// <summary>
/// 添加minio权限表
@ -922,6 +921,7 @@ namespace IBKLinker_Minio.Controller.MinioController
return request;
}
/// <summary>
/// 权限查询
/// </summary>
@ -930,37 +930,43 @@ namespace IBKLinker_Minio.Controller.MinioController
/// <param name="EmpowerType"></param>
/// <returns></returns>
[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<IDbContext>("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<IDbContext>("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<MinioUser> dt = db.Query<MinioUser>("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<retqustUser>("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 公用方法

@ -31,8 +31,20 @@ namespace IBKLinker_Minio.Entity.MinioController
}
public class RequstStoragePath: StoragePath
{
public List<StoragePath> requstStoragePaths { get; set; }
}
public class retqustUser : MinioRolePermission
{
/// <summary>
///文件名称
/// </summary>
[Persistent("FILE_NAME"), DisplayName("文件名称")]
public string FileName { get; set; }
/// <summary>
///文件路径
/// </summary>
[Persistent("FILE_PATH"), DisplayName("文件路径")]
public string FilePate { get; set; }
}
}

Loading…
Cancel
Save