1 # frozen_string_literal: true
4 include CanCan::Ability
7 can [:read, :read_one], UserPreference if capability?(token, :allow_read_prefs)
8 can [:update, :update_one, :delete_one], UserPreference if capability?(token, :allow_write_prefs)
13 def capability?(token, cap)
14 token&.read_attribute(cap)