Ignore:
Timestamp:
08/23/24 15:40:14 (5 weeks 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/VetCenterController.cs

    r72b1da2 r118e414  
    2323                return RedirectToAction("AccessDenied", "Error");
    2424            }
     25            // no access for standard user
     26            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
    2527
    2628            // Fetch cities for dropdown
     
    4749            var vetCenters = await db.VetCentersObj.ToListAsync();
    4850            ViewBag.isAuthenticated = User.Identity.IsAuthenticated;
     51            // no access for standard user
     52            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
    4953
    5054            // Проверете дали корисникот е администратор или менаџер
     
    6670
    6771            VetCenter vetClass = await db.VetCentersObj.FindAsync(id);
     72            UsersClass customerClass = await getCrrentUser();
     73            ViewBag.isAuthenticated = customerClass;
    6874            if (vetClass == null)
    6975            {
    7076                return RedirectToAction("NotExist", "Error");
    7177            }
     78            // no access for standard user
     79            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
    7280
    7381            return View(vetClass);
     
    113121                return RedirectToAction("AccessDenied", "Error");
    114122            }
     123            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
     124
    115125
    116126            // Fetch cities for dropdown
     
    154164                return RedirectToAction("NotExist", "Error");
    155165            }
     166            ViewBag.OnlyAdminManager = await checkAuthorizationSpecificRoleAsync(RoleConstants.Admin) ?? await checkAuthorizationSpecificRoleAsync(RoleConstants.Manager);
     167
    156168
    157169            return View(vetClass);
Note: See TracChangeset for help on using the changeset viewer.