端口修改回 3

用户授权 处理
This commit is contained in:
wyw 2025-09-01 16:06:50 +08:00
parent a2167ae8e3
commit c8753e3500
15 changed files with 109 additions and 15 deletions

View File

@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Test"
},
"nativeDebugging": true,
"applicationUrl": "http://localhost:5101"
"applicationUrl": "http://localhost:3101"
},
"Docker": {
"commandName": "Docker",

View File

@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Test"
},
"nativeDebugging": true,
"applicationUrl": "http://localhost:5178"
"applicationUrl": "http://localhost:3178"
},
"Docker": {
"commandName": "Docker",

View File

@ -989,6 +989,98 @@ namespace APT.FM.WebApi.Controllers.Api.FM
});
}
/// <summary>
/// 用户权限更新
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost, Route("UpdateAuth")]
public JsonActionResult<bool> UpdateAuth([FromBody] T_FM_USER entity)
{
return SafeExecute<bool>(() =>
{
var roleIds = entity.Nav_BelongRoles.Select(role => role.BELONG_ROLE_ID).Distinct().ToList();
var roleGroup = this.GetEntities<T_FM_ROLE_GROUP_BELONG_ROLE>(t => roleIds.Contains(t.BELONG_ROLE_ID), new BaseFilter(entity.ORG_ID));
if (roleGroup != null && roleGroup.Any())
{
roleGroup.ForEach(role =>
{
T_FM_USER_BELONG_ROLE_GROUP belongRole = new T_FM_USER_BELONG_ROLE_GROUP();
belongRole.USER_ID = entity.ID;
belongRole.BELONG_ROLE_GROUP_ID = (Guid)role.ROLE_GROUP_ID;
belongRole.ORG_ID = entity.ORG_ID;
//roleGroupList.Add(belongRole);
entity.Nav_BelongRoleGroups.Add(belongRole);
});
}
var belongRoleGroups = entity.Nav_BelongRoleGroups;//roleGroupList;
var belongRoles = entity.Nav_BelongRoles;//roleList;
var belongUserGroups = entity.Nav_BelongUserGroups;
entity.Nav_BelongRoleGroups = null;
entity.Nav_BelongRoles = null;
entity.Nav_BelongUserGroups = null;
if (belongUserGroups != null && belongUserGroups.Count > 0)
belongUserGroups.ForEach(t => t.USER_ID = entity.ID);
if (belongRoleGroups != null && belongRoleGroups.Any())
belongRoleGroups.ForEach(t => t.USER_ID = entity.ID);
if (belongRoles != null && belongRoles.Any())
belongRoles.ForEach(t => t.USER_ID = entity.ID);
List<Guid> deleteBelongRoleIds = new List<Guid>();
List<Guid> deleteBelongRoleGroupIds = new List<Guid>();
List<Guid> deleteBelongUserGroupsIds = new List<Guid>();
var dbEntity = this.GetEntity<T_FM_USER>(entity.ID.ToString(), new string[] { "Nav_BelongRoleGroups",
"Nav_BelongRoles", "Nav_BelongUserGroups" });
if (dbEntity != null)
{
if (dbEntity.Nav_BelongRoleGroups != null)
{
dbEntity.Nav_BelongRoleGroups.ForEach(item =>
{
if (belongRoleGroups == null || !belongRoleGroups.Any(i => i.ID == item.ID))
deleteBelongRoleGroupIds.Add(item.ID);
});
}
if (dbEntity.Nav_BelongRoles != null)
{
dbEntity.Nav_BelongRoles.ForEach(item =>
{
if (belongRoles == null || !belongRoles.Any(i => i.ID == item.ID))
deleteBelongRoleIds.Add(item.ID);
});
}
if (dbEntity.Nav_BelongUserGroups != null)
{
dbEntity.Nav_BelongUserGroups.ForEach(item =>
{
if (belongUserGroups == null || !belongUserGroups.Any(i => i.ID == item.ID))
deleteBelongUserGroupsIds.Add(item.ID);
});
}
}
UnifiedCommit(() =>
{
if (deleteBelongRoleIds.Any())
this.DeleteEntityNoCommit<T_FM_USER_BELONG_ROLE>(t => deleteBelongRoleIds.Contains(t.ID));
if (deleteBelongRoleGroupIds.Any())
this.DeleteEntityNoCommit<T_FM_USER_BELONG_ROLE_GROUP>(t => deleteBelongRoleGroupIds.Contains(t.ID));
if (deleteBelongUserGroupsIds.Any())
this.DeleteEntityNoCommit<T_FM_USER_BELONG_USER_GROUP>(t => deleteBelongUserGroupsIds.Contains(t.ID));
if (belongRoleGroups != null && belongRoleGroups.Any())
this.BantchSaveEntityNoCommit(belongRoleGroups);
if (belongRoles != null && belongRoles.Any())
this.BantchSaveEntityNoCommit(belongRoles);
if (belongUserGroups != null && belongUserGroups.Any())
this.BantchSaveEntityNoCommit(belongUserGroups);
});
return true;
});
}
/// <summary>
/// 批量删除
/// </summary>

View File

@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Test"
},
"nativeDebugging": false,
"applicationUrl": "http://localhost:5107"
"applicationUrl": "http://localhost:3107"
},
"Docker": {
"commandName": "Docker",

View File

@ -7,7 +7,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Test"
},
"applicationUrl": "http://localhost:5119",
"applicationUrl": "http://localhost:3119",
"nativeDebugging": false
},
"Docker": {

View File

@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Test"
},
"nativeDebugging": true,
"applicationUrl": "http://localhost:5117"
"applicationUrl": "http://localhost:3117"
},
"Docker": {
"commandName": "Docker",

View File

@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Test"
},
"nativeDebugging": false,
"applicationUrl": "http://localhost:5109"
"applicationUrl": "http://localhost:3109"
},
"Docker": {
"commandName": "Docker",

View File

@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Test"
},
"nativeDebugging": false,
"applicationUrl": "http://localhost:5111"
"applicationUrl": "http://localhost:3111"
},
"Docker": {
"commandName": "Docker",

View File

@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Test"
},
"nativeDebugging": false,
"applicationUrl": "http://localhost:5116"
"applicationUrl": "http://localhost:3116"
},
"Docker": {
"commandName": "Docker",

View File

@ -221,6 +221,8 @@ namespace APT.PF.WebApiControllers.Api.PF
if (string.IsNullOrEmpty(filter.Parameter4) && !filter.OrgId.HasValue && Request.Host.HasValue && Request.Host.Port.HasValue)
{
//telnetCode 根据 telnetCode 获取
var re = Request.Headers;
int hostPort = 0;
if (re.ContainsKey("Origin"))
@ -275,8 +277,8 @@ namespace APT.PF.WebApiControllers.Api.PF
T_FM_USER user = null;
if (platformType == (int)PFPlatTypeEnum.)
{
if (string.IsNullOrEmpty(filter.Parameter4))
throw new Exception(ErrMsg.FM_NO_ORG);
//if (string.IsNullOrEmpty(filter.Parameter4))
// throw new Exception(ErrMsg.FM_NO_ORG);
if (string.IsNullOrEmpty(userId))
{
string userCode = filter.Parameter1;

View File

@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Test"
},
"nativeDebugging": false,
"applicationUrl": "http://localhost:5112"
"applicationUrl": "http://localhost:3112"
},
"Docker": {
"commandName": "Docker",

View File

@ -7,7 +7,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Test"
},
"applicationUrl": "http://localhost:5118",
"applicationUrl": "http://localhost:3118",
"nativeDebugging": false
},
"Docker": {

View File

@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Test"
},
"nativeDebugging": true,
"applicationUrl": "http://localhost:5179"
"applicationUrl": "http://localhost:3179"
},
"Docker": {
"commandName": "Docker",

View File

@ -7,7 +7,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Test"
},
"applicationUrl": "http://localhost:5180",
"applicationUrl": "http://localhost:3180",
"nativeDebugging": false
},
"Docker": {

View File

@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Test"
},
"nativeDebugging": false,
"applicationUrl": "http://localhost:5177"
"applicationUrl": "http://localhost:3177"
},
"Docker": {
"commandName": "Docker",