Skip to content

Commit dc29fe7

Browse files
Authorization handler updated for Web and API modules
1 parent 6f2394c commit dc29fe7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

SharedLibrary/Auth/PermissionHandler.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ protected override async Task HandleRequirementAsync(
4343

4444
if (categories is null) return;
4545

46-
bool IsAllowed = categories.Any( c => c.Modules.Any( m => m.Area == area && m.Controller == controller && m.Action == action));
47-
48-
46+
bool IsAllowed = false;
47+
if (requirement.Permission == "Web")
48+
IsAllowed = categories.Any( c => c.Modules.Any( m => m.Area == area && m.Controller == controller && m.Action == action && m.Type == "WebApp"));
49+
else if (requirement.Permission == "Api")
50+
IsAllowed = categories.Any(c => c.Modules.Any(m => m.Controller == controller && m.Action == action && m.Type == "Api"));
51+
52+
4953
if (IsAllowed)
5054
context.Succeed(requirement);
5155
}

0 commit comments

Comments
 (0)