示例#1
0
 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);
     }
 }
示例#2
0
        /// <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);
            }
        }