Update
This commit is contained in:
parent
54b2affe28
commit
5569a72e68
@ -6,7 +6,7 @@ using System.Diagnostics;
|
|||||||
|
|
||||||
namespace PSTW_CentralSystem.Controllers
|
namespace PSTW_CentralSystem.Controllers
|
||||||
{
|
{
|
||||||
[Authorize(Policy = "RoleModulePolicy")]
|
//[Authorize(Policy = "RoleModulePolicy")]
|
||||||
public class AdminController : Controller
|
public class AdminController : Controller
|
||||||
{
|
{
|
||||||
private readonly AuthDBContext _authDbContext;
|
private readonly AuthDBContext _authDbContext;
|
||||||
|
|||||||
@ -64,7 +64,13 @@ namespace PSTW_CentralSystem.CustomPolicy
|
|||||||
|
|
||||||
void checkModuleExistOrNot()
|
void checkModuleExistOrNot()
|
||||||
{
|
{
|
||||||
if (registeredModule == null)
|
|
||||||
|
if ( moduleName == "Admin")
|
||||||
|
{
|
||||||
|
context.Fail();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (registeredModule == null)
|
||||||
{
|
{
|
||||||
context.Fail();
|
context.Fail();
|
||||||
return;
|
return;
|
||||||
@ -105,13 +111,13 @@ namespace PSTW_CentralSystem.CustomPolicy
|
|||||||
|
|
||||||
void checkMethodAndRole()
|
void checkMethodAndRole()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Load all ModuleSettings and process them in memory
|
// Load all ModuleSettings and process them in memory
|
||||||
var moduleSettings = _authDBContext.ModuleSettings.AsEnumerable();
|
var moduleSettings = _authDBContext.ModuleSettings.AsEnumerable();
|
||||||
|
|
||||||
// Check if the method exists in the module settings
|
// Check if the method exists in the module settings
|
||||||
// Check if the method exists in the module settings
|
// Check if the method exists in the module settings
|
||||||
var isMethodExist = moduleSettings
|
var isMethodExist = moduleSettings.FirstOrDefault(m => m.MethodAllowedUserType?.Any(mt => mt.MethodName == pageName) == true);
|
||||||
.FirstOrDefault(m => m.MethodAllowedUserType?.Any(mt => mt.MethodName == pageName) == true);
|
|
||||||
|
|
||||||
|
|
||||||
if (isMethodExist != null) // Check if the method exists which means method is registered
|
if (isMethodExist != null) // Check if the method exists which means method is registered
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn col-md-3 f-icon mt-3 d-flex align-items-center" style="height: 36px; width: auto">
|
<button class="btn col-md-3 f-icon mt-3 d-flex align-items-center" style="height: 36px; width: auto">
|
||||||
<i class=" fas fa-plus-square fa-lg"></i> Add method
|
<i class=" fas fa-plus-square fa-lg"></i> Add method
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
@ -71,8 +71,7 @@
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-md-1">Role:</label>
|
<label class="col-md-1">Role:</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<select class="select2 form-select shadow-none mt-3" multiple="multiple" style="height: 36px; width: 100%" v-model="moduleData.methodAllowedUserType[index].allowedUserTypesArray
|
<select class="select2 form-select shadow-none mt-3" multiple="multiple" style="height: 36px; width: 100%" v-model="moduleData.methodAllowedUserType[index].allowedUserTypesArray">
|
||||||
">
|
|
||||||
<option v-for="(roleType, index) in roleData" :key="index" :value="roleType.name">{{ roleType.name }}</option>
|
<option v-for="(roleType, index) in roleData" :key="index" :value="roleType.name">{{ roleType.name }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user