Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
module Users
class Permission
private attr_reader :user, :resource, :public_key
def initialize(user, resource = nil, public_key: nil)
@user = user
@resource = resource
@public_key = public_key
end
def authorized?
customer? || owner? || public_access?
end
private
def customer?
user&.permissions&.active_subscription?
end
def owner?
user.present? && resource&.user == user
end
def public_access?
resource&.valid_public_profile_access?(public_key)
end
end
end