Ignore:
Timestamp:
08/23/24 15:40:14 (2 months ago)
Author:
ElenaMoskova <elena.moskova99@…>
Branches:
main
Children:
e9bb9d1
Parents:
72b1da2
Message:

fix access

implement multiple access pages with different roles
optimize present three structure of BlogPost and Answer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • PostgreSqlDotnetCore/Controllers/ProductsController.cs

    r72b1da2 r118e414  
    3131            ViewBag.isAuthenticated = await getCrrentUser();
    3232            ViewBag.hasAccess = await checkAuthorizationAsync();
     33            // no access for standard user
     34            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
     35
    3336            if (!String.IsNullOrEmpty(searchString))
    3437            {
     
    5962                return RedirectToAction("NotExist", "Error");
    6063            }
     64            // no access for standard user
     65            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
     66
    6167            return View(prodClass);
    6268        }
     
    7985                return RedirectToAction("AccessDenied", "Error");
    8086            }
     87            // no access for standard user
     88            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
     89
    8190            var model = new ProductsClass
    8291            {
Note: See TracChangeset for help on using the changeset viewer.