public static void CheckUserRole(UserDto activeUser, string roles, ActionExecutingContext context) { if (!string.IsNullOrWhiteSpace(roles)) { Status status; if (roles.Contains(",")) { StatusBuilderDirector director = new StatusBuilderDirector(new MultiRoleStatusBuilder()); status = director.GenerateStatus(activeUser, roles); } else { StatusBuilderDirector director = new StatusBuilderDirector(new SingleRoleStatusBuilder()); status = director.GenerateStatus(activeUser, roles); } CheckStatus(status, context); } }
/// <summary> /// aktif userin rol bazlı durumu kontrol eder /// </summary> /// <param name="activeUser"></param> /// <param name="roles"></param> /// <param name="context"></param> public static void CheckUserRole(AppUser activeUser, string roles, ActionExecutingContext context) { if (String.IsNullOrEmpty(roles) == false) { Status status = null; if (roles.Contains(",")) { StatusBuilderDirector director = new StatusBuilderDirector(new MultiRoleStatusBuilder()); status = director.GenerateStatus(activeUser, roles); } else { StatusBuilderDirector director = new StatusBuilderDirector(new SingleRoleStatusBuilder()); status = director.GenerateStatus(activeUser, roles); } CheckStatus(status, context); } }