def load!(io)
      doc = YAML.load(io)
      return self unless doc
      (doc["groups"] || {}).each do |portal, top_level_groups|
        @groups[portal.to_sym] = top_level_groups.collect { |group_data| build_group(group_data) }
      end
      (doc["users"] || {}).each do |username, config|
        attr_keys = config.keys - ["password", "portals", "identifiers"]

        valid_credentials!(:user, username, config["password"]) do |u|
          attr_keys.each do |k|
            begin
              u.send("#{k}=", config[k])
            rescue NoMethodError
              raise NoMethodError, "#{k} is not a recognized user attribute"
            end
          end

          portal_data = config["portals"] || []

          portals_and_groups_from_yaml(portal_data) do |portal, group, affiliate_ids|
            u.default_portal = portal unless u.default_portal

            u.in_portal!(portal)

            if group
              if affiliate_ids
                u.in_group!(portal, group, :affiliate_ids => affiliate_ids)
              else
                u.in_group!(portal, group)
              end
            end
          end

          (config["identifiers"] || {}).each do |ident, value|
            u.identifiers[ident.to_sym] = value
          end
        end
      end

      self
    end
def load!(io)
      doc = YAML.load(io)
      return self unless doc
      (doc["groups"] || {}).each do |portal, top_level_groups|
        @groups[portal.to_sym] = top_level_groups.collect { |group_data| build_group(group_data) }
      end
      (doc["users"] || {}).each do |username, config|
        attr_keys = config.keys - ["password", "portals", "identifiers"]

        valid_credentials!(:user, username, config["password"]) do |u|
          attr_keys.each do |k|
            begin
              u.send("#{k}=", config[k])
            rescue NoMethodError
              raise NoMethodError, "#{k} is not a recognized user attribute"
            end
          end

          portal_data = config["portals"] || []

          portals_and_groups_from_yaml(portal_data) do |portal, group, affiliate_ids|
            u.default_portal = portal unless u.default_portal

            u.in_portal!(portal)

            if group
              if affiliate_ids
                u.in_group!(portal, group, :affiliate_ids => affiliate_ids)
              else
                u.in_group!(portal, group)
              end
            end
          end

          (config["identifiers"] || {}).each do |ident, value|
            u.identifiers[ident.to_sym] = value
          end
        end
      end

      self
    end
Loads a YAML doc and uses its contents to initialize the
 authority's authentication and authorization data.

 Sample doc:

     users:
       wakibbe:               # username
         password: ekibder    # password for :user auth (optional)
         first_name: Warren   # any attributes from Aker::User may
         last_name: Kibbe     #   be set here
         identifiers:         # identifiers will be loaded with
           employee_id: 4     # symbolized keys
         portals:             # portal & group auth info (optional)
           - SQLSubmit        # A groupless portal
           - ENU:             # A portal with simple groups
             - User
           - NOTIS:           # A portal with affiliated groups
             - Manager: [23]
             - User           # you can mix affiliated and simple

     groups:                  # groups for hierarchical portals
       NOTIS:                 # (these aren't real NOTIS groups)
         - Admin:
           - Manager:
             - User
           - Auditor

 @param [#read] io a readable handle (something that can be passed to
   `YAML.load`)

 @return [Static] self