Files
fizzy/app/models/user/accessor.rb
T
Donal McBreen fc56ad9d7c Combine uuid-old and uuid branch changes
- Switch to binary 16 for UUID keys
- Remove AccountScopedRecord base class, all model use binary uuids now
- Fix the search sql to serialize uuids properly
- Patch the MySQL schema dumper to output binary lengths
2025-11-17 09:12:34 -05:00

18 lines
586 B
Ruby

module User::Accessor
extend ActiveSupport::Concern
included do
has_many :accesses, dependent: :destroy
has_many :boards, through: :accesses
has_many :accessible_cards, through: :boards, source: :cards
has_many :accessible_comments, through: :accessible_cards, source: :comments
after_create_commit :grant_access_to_boards, unless: :system?
end
private
def grant_access_to_boards
Access.insert_all account.boards.all_access.pluck(:id).collect { |board_id| { id: ActiveRecord::Type::Uuid.generate, board_id: board_id, user_id: id } }
end
end