Created
July 7, 2019 02:47
-
-
Save drusepth/400159608252d838a99ef659a4bb0a2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.config.content_types[:premium].each do |content_type| | |
authorizer_class_name = "#{content_type.name}ContentAuthorizer" | |
Object.const_set(authorizer_class_name, Class.new(ContentAuthorizer) do | |
def self.createable_by?(user) | |
return false if ENV.fetch('CONTENT_BLACKLIST')&.split(',')&.include?(user.email) | |
[ | |
PermissionService.billing_plan_allows_extended_content?(user: user), | |
PermissionService.user_can_collaborate_in_universe_that_allows_extended_content?(user: user), | |
PermissionService.user_has_active_promotion_for_this_content_type(user: user, content_type: content_type.name) | |
].any? | |
end | |
end) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment