Class: AtlasRb::System::User
- Inherits:
-
Object
- Object
- AtlasRb::System::User
- Extended by:
- FaradayHelper
- Defined in:
- lib/atlas_rb/system/user.rb
Overview
SSO-callback user provisioning. Finds the Atlas User row keyed on
the supplied NUID (creating it if missing) and replaces its
groups with the IdP-asserted set. Full replace, not merge —
the IdP assertion is authoritative.
Always authenticates via FaradayHelper#system_connection, so the caller has no way to act as a non-system principal. Atlas allows this endpoint only for the system token + system NUID pairing.
Class Method Summary collapse
-
.find_or_create(nuid:, groups:, name: nil, email: nil) ⇒ AtlasRb::Mash
Find-or-create the User keyed on NUID and replace its groups.
Methods included from FaradayHelper
connection, multipart, system_connection
Class Method Details
.find_or_create(nuid:, groups:, name: nil, email: nil) ⇒ AtlasRb::Mash
Find-or-create the User keyed on NUID and replace its groups.
60 61 62 63 64 65 66 67 |
# File 'lib/atlas_rb/system/user.rb', line 60 def self.find_or_create(nuid:, groups:, name: nil, email: nil) body = { groups: groups } body[:name] = name if name body[:email] = email if email response = system_connection.put("/users/by_nuid/#{nuid}", body.to_json) AtlasRb::Mash.new(JSON.parse(response.body))["user"] end |