Make default user level and settings configurable.

Remove start_as_gold? and start_as_contributor? from default config
because they don't actually do anything. `git log -G start_as` indicates
they never have done anything.

Add a more general customize_new_user method for setting the starting
user level, permissions and defaults for any other settings.
This commit is contained in:
evazion 2016-10-05 00:56:07 +00:00
parent ebff27c7c0
commit c3b55e80c5
2 changed files with 18 additions and 8 deletions

View File

@ -64,6 +64,7 @@ class User < ActiveRecord::Base
after_save :update_cache
after_update :update_remote_cache
before_create :promote_to_admin_if_first_user
before_create :customize_new_user
#after_create :notify_sock_puppets
has_many :feedback, :class_name => "UserFeedback", :dependent => :destroy
has_many :posts, :foreign_key => "uploader_id"
@ -311,6 +312,10 @@ class User < ActiveRecord::Base
end
end
def customize_new_user
Danbooru.config.customize_new_user(self)
end
def role
case level
when Levels::MEMBER

View File

@ -49,14 +49,19 @@ module Danbooru
"choujin-steiner"
end
# Set to true to give all new users gold access.
def start_as_gold?
false
end
# Set to true to give all new users contributor access.
def start_as_contributor?
false
# Set the default level, permissions, and other settings for new users here.
def customize_new_user(user)
# user.level = User::Levels::MEMBER
# user.can_approve_posts = false
# user.can_upload_free = false
# user.is_super_voter = false
#
# user.base_upload_limit = 10
# user.comment_threshold = -1
# user.blacklisted_tags = ["spoilers", "guro", "scat", "furry -rating:s"].join("\n")
# user.default_image_size = "large"
# user.per_page = 20
# user.disable_tagged_filenames = false
end
# What method to use to store images.