Added ability to set password for groups

• Added:
- ability to set password for groups
- GroupPasswordModal
- checks for if has password
- rate limiting in rack_attack
This commit is contained in:
mgabdev
2020-09-11 17:27:00 -05:00
parent 1baa123e25
commit 6d85c76c8f
13 changed files with 435 additions and 71 deletions

View File

@@ -4,12 +4,25 @@ class REST::GroupSerializer < ActiveModel::Serializer
include RoutingHelper
attributes :id, :title, :description, :description_html, :cover_image_url, :is_archived,
:member_count, :created_at, :is_private, :is_visible, :slug, :tags, :group_category
:member_count, :created_at, :is_private, :is_visible, :slug, :tags, :group_category, :password,
:has_password
def id
object.id.to_s
end
def has_password
return !!password
end
def password
if object.group_accounts.where(account_id: current_user.account.id, role: :admin).exists?
object.password
else
nil
end
end
def group_category
if object.group_categories
object.group_categories