@ -175,9 +175,9 @@ namespace IBKLinker_Minio.Controller.MinioController
/// <summary>
/// 添加minio权限表
/// </summary>
/// <param name=" cS_B04_PL_STEEL_ROW_COMP">合金配比策略一基表Model </param>
/// <param name=" minioAuthority">权限表 </param>
[HttpPost, Route("AddAuthority")]
public RequestEntity AddAuthority ( MinioAuthority cS_B04_PL_STEEL_ROW_COMP )
public RequestEntity AddAuthority ( MinioAuthority minioAuthority )
{
RequestEntity request = new RequestEntity ( ) ;
try
@ -186,12 +186,12 @@ namespace IBKLinker_Minio.Controller.MinioController
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
{
///拿到表自增长的值赋值给自增长主键pk
cS_B04_PL_STEEL_ROW_COMP . Id = getPk ( "S_MINIO_AUTHORITY" , "MINIO_AUTHORITY" ) ;
minioAuthority . Id = getPk ( "S_MINIO_AUTHORITY" , "MINIO_AUTHORITY" ) ;
///给创建时间赋值
cS_B04_PL_STEEL_ROW_COMP . CreatorTime = DateTime . Now ;
minioAuthority . CreatorTime = DateTime . Now ;
///把需要添加的数据同步到数据库
db . Insert < MinioAuthority > ( cS_B04_PL_STEEL_ROW_COMP ) ;
db . Insert < MinioAuthority > ( minioAuthority ) ;
request . code = "0" ;
}
}
@ -309,7 +309,7 @@ namespace IBKLinker_Minio.Controller.MinioController
/// <summary>
/// 添加minio角色表
/// </summary>
/// <param name=" cS_B04_PL_STEEL_ROW_COMP">合金配比策略一基表Model </param>
/// <param name=" minioUser">角色表 </param>
[HttpPost, Route("AddUSER")]
public RequestEntity AddUSER ( MinioUser minioUser )
{
@ -439,11 +439,11 @@ namespace IBKLinker_Minio.Controller.MinioController
# endregion
#region minio文件关联表 表
#region minio文件关联表
/// <summary>
/// 添加minio角色表
/// </summary>
/// <param name="minioFileassociation"> 合金配比策略一基表Model </param>
/// <param name="minioFileassociation"> 文件关联表 </param>
[HttpPost, Route("AddFileassociation")]
public RequestEntity AddFileassociation ( MinioFileassociation minioFileassociation )
{
@ -847,6 +847,7 @@ namespace IBKLinker_Minio.Controller.MinioController
/// </summary>
/// <param name="PK"></param>
/// <returns></returns>
[HttpPost, Route("GetMenuTree")]
public List < MinioStoragePath > GetMenuTree ( string PK = "" )
{
@ -869,6 +870,7 @@ namespace IBKLinker_Minio.Controller.MinioController
/// 获取根目录和根目录下一级得菜单信息
/// </summary>
/// <returns></returns>
[HttpPost, Route("GetRecursion")]
public RequestEntity GetRecursion ( )
{
RequestEntity request = new RequestEntity ( ) ;
@ -920,14 +922,45 @@ namespace IBKLinker_Minio.Controller.MinioController
return request ;
}
/// <summary>
/// 权限查询
/// </summary>
/// <param name="UserID"></param>
/// <param name="FileName"></param>
/// <param name="EmpowerType"></param>
/// <returns></returns>
[HttpPost, Route("GetEmpower")]
public bool GetEmpower ( string UserID , string FileName , string EmpowerType )
{
bool Empower = false ;
//用户ID, 文件ID, 文件操作类型( 查看/移动)
using ( IDbContext db = ObjectContainer . GetObject < IDbContext > ( "db" ) )
{
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 ;
}
}
//通过用户ID查询用户得角色ID,
//判断当前角色是否有操作权限
//通过角色ID查询用户有权限得文件夹
return false ;
return Empower ;
}
# endregion
#region 公用方法