Exemple #1
0
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            Identity.Identity identity = context.HttpContext.GetIdentity();

            if (identity != null && identity.Role == CustomIdentityRole.Beneficiary && !(context.Controller is BeneficiaryController controller))
            {
                context.Result = new RedirectToActionResult(nameof(BeneficiaryController.Index), nameof(BeneficiaryController)[0..^ 10], null);
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            Identity.Identity identity = context.HttpContext.GetIdentity();

            if (identity != null && (identity.Role == CustomIdentityRole.Volunteer || identity.Role == CustomIdentityRole.NGOAdmin) && !(context.Controller is VolunteersController controller))
            {
                context.Result = new RedirectToActionResult(nameof(VolunteersController.Index), nameof(VolunteersController)[0..^ 10], null);
Exemple #3
0
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            Identity.Identity identity = context.HttpContext.GetIdentity();

            if (identity != null && (identity.Role == CustomIdentityRole.Admin) &&
                (!(context.Controller is AdministrationController) &&
                 !(context.Controller is ServiceController) &&
                 !(context.Controller is CategoryController) &&
                 !(context.Controller is NGOsController)))
            {
                context.Result = new RedirectToActionResult(nameof(AdministrationController.Index), nameof(AdministrationController)[0..^ 10], null);