Authorization
# avo-2
m
Hey all! Noticing something strange with resource policies in v2.33 we have the following set up
Copy code
class ConversationPolicy < ApplicationPolicy
  def index?
    user.admin?
  end

  def show?
    user.admin?
  end
end
ApplicationPolicy
Copy code
class ApplicationPolicy
  attr_reader :user, :record

  def initialize(user, record)
    @user = user
    @record = record
  end

  def index?
    false
  end

  def show?
    false
  end

  def create?
    false
  end

  def new?
    create?
  end

  def update?
    false
  end

  def edit?
    update?
  end

  def destroy?
    false
  end

  class Scope # rubocop:disable Style/Documentation
    def initialize(user, scope)
      @user = user
      @scope = scope
    end

    def resolve
      raise NotImplementedError, "You must define #resolve in #{self.class}"
    end

    private

    attr_reader :user, :scope
  end
end
What's odd is that when I go to the index for that resource, I can still see the edit and delete icons. This is true in our production environment. In our staging/qa environment, we ONLY see the view icon. So for some reason our staging/qa is following the policy defined, whereas our production environment it's ignoring the policy set up in
ApplicationPolicy
. I guess I could try to define the `edit`/`update`/`destroy` policies in
ConversationPolicy
outright...but you would think I shouldn't have to. Any thoughts?
l
Hey @mammoth-notebook-46426. What kind of license do you have? authorization is a pro license feature
m
Hey! We should have a pro license
We have a handful...lemme make sure we're using the right key in this app
l
Haha. What apps do you use it on
?
You can write in private if you wish
m
Actually I think I see our issue...we may have forgotten to set the license key in our prod environment