Sha256: d563622c470f01e2d31dc133cc0f82b62d4ada6a9e0d48b2f874aa3aa219d40d

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

module Georgia
  class NavigationPolicy < ApplicationPolicy

    def index?
      navigation_user_permissions(:show_menus).include?(true)
    end

    def show?
      edit?
    end

    def new?
      create?
    end

    def create?
      navigation_user_permissions(:create_menus).include?(true)
    end

    def edit?
      update?
    end

    def update?
      navigation_user_permissions(:update_menus).include?(true)
    end

    def destroy?
      navigation_user_permissions(:delete_menus).include?(true)
    end

    private

    def navigation_permissions
      Georgia.permissions[:navigation]
    end

    def navigation_user_permissions action
      user_permissions(navigation_permissions, action)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
georgia-0.8.0 app/policies/georgia/navigation_policy.rb