mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
16 lines
428 B
Ruby
16 lines
428 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Authorisations of a user allowing a platform to access to data.
|
|
class DfcPermission < ApplicationRecord
|
|
SCOPES = %w[
|
|
ReadEnterprise ReadProducts ReadOrders
|
|
WriteEnterprise WriteProducts WriteOrders
|
|
].freeze
|
|
|
|
belongs_to :user, class_name: "Spree::User"
|
|
belongs_to :enterprise
|
|
|
|
validates :grantee, presence: true
|
|
validates :scope, presence: true, inclusion: { in: SCOPES }
|
|
end
|