mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
993 B
27 lines
993 B
# frozen_string_literal: true
|
|
|
|
class Ability
|
|
include CanCan::Ability
|
|
|
|
def initialize(user)
|
|
can :manage, Template, account_id: user.account_id
|
|
|
|
can %i[read update create], Template,
|
|
Abilities::TemplateConditions.collection(user) do |template|
|
|
Abilities::TemplateConditions.entity(template, user:, ability: 'manage')
|
|
end
|
|
|
|
can :manage, TemplateFolder, account_id: user.account_id
|
|
can :manage, TemplateSharing, template: { account_id: user.account_id }
|
|
can :manage, Submission, account_id: user.account_id
|
|
can :manage, Submitter, submission: { account_id: user.account_id }
|
|
can :manage, User, account_id: user.account_id
|
|
can :manage, EncryptedConfig, account_id: user.account_id
|
|
can :manage, EncryptedUserConfig, user_id: user.id
|
|
can :manage, AccountConfig, account_id: user.account_id
|
|
can :manage, UserConfig, user_id: user.id
|
|
can :manage, Account, id: user.account_id
|
|
can :manage, AccessToken, user_id: user.id
|
|
end
|
|
end
|