Class: RivetCms::User

Inherits:
ApplicationRecord show all
Includes:
OrganizationScoped
Defined in:
app/models/rivet_cms/user.rb

Overview

Admin account for built-in authentication mode. Dormant when the host wires its own auth: nothing reads this table unless RivetCms.builtin_auth?

CE has no roles: every authenticated user can do everything, so this model carries only identity and sign-in state. Role-based and per-record permissions are a Pro feature that installs its own policy through the can? seam and its own tables.

Accounts are always created by an existing user (or the first-run setup screen); there is no self-registration. A user created without a password is pending: they finish through a signed set-password link and cannot sign in before that. Deactivation, never deletion: audit events and content attribution reference these rows.

Instance Method Summary collapse

Instance Method Details

#can_sign_in?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'app/models/rivet_cms/user.rb', line 49

def can_sign_in?
  active? && !pending?
end

#pending?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'app/models/rivet_cms/user.rb', line 38

def pending?
  password_digest.nil?
end

#statusObject



42
43
44
45
46
47
# File 'app/models/rivet_cms/user.rb', line 42

def status
  return "inactive" unless active?
  return "pending" if pending?

  "active"
end