def demote
      # remove the administrator flag from the selected user.
      if @user.system_admin?
        if @user.update(system_admin: false)
          flash[:success] = "User #{@user} has been demoted from administrator."
        else
          flash[:danger] = "Failed to demote user #{@user}."
        end
      else
        flash[:warning] = "User #{@user} is not an administrator."
        unless inline_request?
          redirect_to users_path and return
        end
      end

      if inline_request?
        render 'show', formats: [ :json ]
      else
        redirect_to users_path
      end

    end
def demote
      # remove the administrator flag from the selected user.
      if @user.system_admin?
        if @user.update(system_admin: false)
          flash[:success] = "User #{@user} has been demoted from administrator."
        else
          flash[:danger] = "Failed to demote user #{@user}."
        end
      else
        flash[:warning] = "User #{@user} is not an administrator."
        unless inline_request?
          redirect_to users_path and return
        end
      end

      if inline_request?
        render 'show', formats: [ :json ]
      else
        redirect_to users_path
      end

    end
PUT /incline/users/1/demote