1.优化考试管理页面权限控制,培训_考试_成绩、复制、归档、取消发布、预览、考试链接

master
xiaochanghai 1 year ago
parent c31085dfa5
commit 4eb9675658
  1. 27
      Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs

@ -59,9 +59,6 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
var Toolbar = new List<Toolbar>();
#region 定义页面的操作按钮
string sql = @"SELECT fnKey,
fnKeyValue,
@ -218,6 +215,14 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
sql = string.Format(sql, param.menuName, App.User.ID, param.langId);
var toolbars = DbAccess.QueryList<Toolbar>(sql);
sql = $@"SELECT A.RoleId, B.RoleNo, B.RoleName
FROM Ghrs_UserRole A LEFT JOIN Ghrs_Role B ON A.RoleId = B.RoleId
WHERE A.UserID = {App.User.ID}
AND A.IsEnable = 1
AND B.IsEnable = 1
AND B.RoleNo LIKE 'TrainingExam%'";
var toolbarRoles = DbAccess.QueryList<ToolbarRole>(sql);
if (toolbars.Any(x => x.fnKey == "NewYN"))
Toolbar.Add(new Toolbar()
{
@ -241,10 +246,10 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
display = true
});
if (param.menuName == "F_ExamManageReleased")
if (param.menuName == "F_ExamManageReleased" && toolbarRoles.Any(x => x.RoleNo == "TrainingExamCancelRelease"))
Toolbar.Add(new Toolbar()
{
fnKey = "Release",
fnKey = "CancelRelease",
fnKeyValue = null,
fnTitle = "取消发布",
fnType = "table",
@ -1018,15 +1023,19 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
public async Task<ServiceResult> UpdateStatus(long[] ids, string status)
{
string sql = $@"SELECT A.RoleId, B.RoleNo, B.RoleName
if (status == "Draft")
{
string sql = $@"SELECT A.RoleId, B.RoleNo, B.RoleName
FROM Ghrs_UserRole A LEFT JOIN Ghrs_Role B ON A.RoleId = B.RoleId
WHERE A.UserID = {App.User.ID}
AND A.IsEnable = 1
AND B.IsEnable = 1
AND B.RoleNo ='TrainingExamCancelRelease'";
var toolbarRoles = DbAccess.QueryList<ToolbarRole>(sql);
if (!toolbarRoles.Any())
return ServiceResult.OprateFailed("暂无取消发布权限!");
var toolbarRoles = DbAccess.QueryList<ToolbarRole>(sql);
if (!toolbarRoles.Any())
return ServiceResult.OprateFailed("暂无取消发布权限!");
}
if (status != "Released" && status != "Disabled" && status != "Draft")
throw new Exception("无效的状态");

Loading…
Cancel
Save