Sha256: 784101424135c8604efc3f3a593532245105e0416a857474ac2ac849ee36b2cc

Contents?: true

Size: 533 Bytes

Versions: 7

Compression:

Stored size: 533 Bytes

Contents

module TheRole
  module Controller
    def login_required
      send TheRole.config.login_required_method
    end

    def role_access_denied
      send TheRole.config.access_denied_method
    end

    private

    def role_required
      role_access_denied unless current_user.has_role?(controller_path, action_name)
    end

    def owner_required
      # TheRole: You should define OWNER CHECK OBJECT
      # When editable object was found
      role_access_denied unless current_user.owner?(@owner_check_object)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
the_role-2.5.4 app/controllers/concerns/controller.rb
the_role-2.5.3 app/controllers/concerns/controller.rb
the_role-2.5.2 app/controllers/concerns/controller.rb
the_role-2.5.1 app/controllers/concerns/controller.rb
the_role-2.5 app/controllers/concerns/controller.rb
the_role-2.4 app/controllers/concerns/controller.rb
the_role-2.3 app/controllers/concerns/controller.rb