Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public override void OnActionExecuting(ActionExecutingContext filterContext)
- {
- RouteValueDictionary path;
- object objId;
- if (filterContext.ActionParameters.TryGetValue("id", out objId))
- {
- var id = new Guid(objId.ToString());
- var user = filterContext.HttpContext.User as SMPrincipal;
- if (user != null && user.AccountID != id)
- {
- var userRoleType = user.getRoleType();
- if (userRoleType == RoleEnum.Patient)
- {
- var followerRepo = new FollowerRepository(new SMContext());
- if (!followerRepo.IsAccountIdFollowingViewId(user.AccountID, id))
- {
- path = MVC.User.Access.Denied().GetRouteValueDictionary();
- filterContext.Result = new RedirectToRouteResult(path);
- }
- }
- }
- }
- base.OnActionExecuting(filterContext);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement