- A
- B
- C
- E
- F
- H
- I
- L
- M
- O
- P
- R
- T
- U
- W
Instance Public methods
active_plan() Link
Source: show
# File app/models/site_owner.rb, line 135 def active_plan active_subscription&.memberspace_plan || active_plans.first end
active_plan?() Link
Source: show
# File app/models/site_owner.rb, line 131 def active_plan? active_plan.present? end
active_subscription() Link
Source: show
# File app/models/site_owner.rb, line 143 def active_subscription active_subscriptions.first end
affiliate_referral?() Link
Source: show
# File app/models/site_owner.rb, line 95 def affiliate_referral? !!metadata["affiliate_referral"] end
available_plans() Link
Source: show
# File app/models/site_owner.rb, line 99 def available_plans site.memberspace_plans.reject(&:specific_time_expired?) - expired_plans.select(&:free_plan_type?) end
broadcast_emails_per_month_limit() Link
Source: show
# File app/models/site_owner.rb, line 235 def broadcast_emails_per_month_limit super || ENV["BROADCAST_EMAILS_PER_MONTH_LIMIT"].to_i end
broadcast_emails_sent_this_month() Link
Source: show
# File app/models/site_owner.rb, line 239 def broadcast_emails_sent_this_month broadcasts .where(sent_at: Time.current.beginning_of_month..Time.current.end_of_month) .sum(:recipient_count) end
can_create_free_plans?() Link
Source: show
# File app/models/site_owner.rb, line 174 def can_create_free_plans? feature_enabled?(:can_create_free_plans) end
can_create_organization?() Link
@return [Boolean] true if any active_plans enable creating an organization @return [Boolean] false if no active_plans enable creating an organization
This method has to use its own special technique because the agency plan may not be the SiteOwner’s active_plan
A SiteOwner will have more than one active_plans concurrent only with an agency-enabled plan, and only until they create an Organization
Source: show
# File app/models/site_owner.rb, line 198 def can_create_organization? active_plans.any?(&:can_create_organization?) end
can_invite_site_admins?() Link
Source: show
# File app/models/site_owner.rb, line 203 def can_invite_site_admins? feature_enabled?(:can_invite_site_admins) end
can_remove_branding?() Link
Source: show
# File app/models/site_owner.rb, line 179 def can_remove_branding? feature_enabled?(:can_remove_branding) end
can_send_broadcasts?() Link
Source: show
# File app/models/site_owner.rb, line 184 def can_send_broadcasts? feature_enabled?(:can_send_broadcasts) end
can_setup_integrations?() Link
Source: show
# File app/models/site_owner.rb, line 208 def can_setup_integrations? feature_enabled?(:can_setup_integrations) end
expired_plans() Link
Source: show
# File app/models/site_owner.rb, line 104 def expired_plans plannings.includes(:memberspace_plan).select(&:expired?).map(&:memberspace_plan) end
feature_disabled?(feature_name) Link
Source: show
# File app/models/site_owner.rb, line 163 def feature_disabled?(feature_name) !feature_enabled?(feature_name) end
feature_enabled?(feature_name) Link
Source: show
# File app/models/site_owner.rb, line 159 def feature_enabled?(feature_name) super_admin? || !!active_plan&.feature_enabled?(feature_name) end
first_site?() Link
Source: show
# File app/models/site_owner.rb, line 116 def first_site? sites.onboarded.empty? end
has_active_site?() Link
Source: show
# File app/models/site_owner.rb, line 112 def has_active_site? owned_or_administered_sites.not_archived.any? end
has_max_sites_limit?() Link
Source: show
# File app/models/site_owner.rb, line 231 def has_max_sites_limit? !super_admin? && site_limiting_plans.any? end
is_site_admin?() Link
Source: show
# File app/models/site_owner.rb, line 120 def is_site_admin? administered_sites.not_archived.any? end
last_site_owner_status() Link
Source: show
# File app/models/site_owner.rb, line 139 def last_site_owner_status subscriptions.order(updated_at: :desc).pick(:status) || "unknown" end
limit_count(limit_name) Link
Source: show
# File app/models/site_owner.rb, line 167 def limit_count(limit_name) case limit_name.to_sym when :max_sites sites_under_plan.count end end
organization_required?() Link
Source: show
# File app/models/site_owner.rb, line 155 def organization_required? !super_admin? && can_create_organization? && organization.nil? end
owned_or_administered_sites() Link
Source: show
# File app/models/site_owner.rb, line 124 def owned_or_administered_sites DB::Site .where(id: administered_site_ids) .or(DB::Site.where(id: site_ids)) .order(:member_id) end
plan_upgrade_required?() Link
Source: show
# File app/models/site_owner.rb, line 151 def plan_upgrade_required? !active_plan&.current? end
reached_max_emails_per_month?() Link
Source: show
# File app/models/site_owner.rb, line 246 def reached_max_emails_per_month? broadcast_emails_sent >= broadcast_emails_per_month_limit end
reached_max_sites_limit?() Link
Source: show
# File app/models/site_owner.rb, line 225 def reached_max_sites_limit? active_plan? && ( has_max_sites_limit? && limit_count(:max_sites) >= maximum_allowed_sites ) end
total_active_member_count() Link
Source: show
# File app/models/site_owner.rb, line 108 def total_active_member_count sites.sum(:active_member_count) end
under_max_sites_limit?() Link
Source: show
# File app/models/site_owner.rb, line 213 def under_max_sites_limit? active_plan? && ( !has_max_sites_limit? || limit_count(:max_sites) < maximum_allowed_sites ) end