module Identity
  class DomainsController < ::DashboardController
    rescue_from "MonsoonOpenstackAuth::Authentication::NotAuthorized", with: :not_member_error
    authorization_required additional_policy_params: {domain_id: proc {@scoped_domain_id}}

    def show
      @user_domain_projects_tree  = services.identity.auth_projects_tree
      @root_projects              = @user_domain_projects.reject{ |project| !project.parent.blank? }
      @domain                     = service_user.find_domain(@scoped_domain_id) if current_user.is_allowed?('identity:domain_get')
    end

    def index
      @domains = services.identity.domains
    end

    def not_member_error
      @error_title = "No domain member"
      @error_message = "You are not a member of the domain #{@scoped_domain_name}."
      render template: '/application/error'
    end
  end
end

module Identity
  class DomainsController < ::DashboardController
    rescue_from "MonsoonOpenstackAuth::Authentication::NotAuthorized", with: :not_member_error
    authorization_required additional_policy_params: {domain_id: proc {@scoped_domain_id}}

    def show
      @user_domain_projects_tree  = services.identity.auth_projects_tree
      @root_projects              = @user_domain_projects.reject{ |project| !project.parent.blank? }
      @domain                     = service_user.find_domain(@scoped_domain_id)
    end

    def index
      @domains = services.identity.domains
    end

    def not_member_error
      @error_title = "No domain member"
      @error_message = "You are not a member of the domain #{@scoped_domain_name}."
      render template: '/application/error'
    end
  end
end

Fix domain get for non admins, Delete nonsense auth. check
Fix domain get for non admins, Delete nonsense auth. check
