Sha256: db98059c188301db6b5a6be923bf3991971a948ffc3695ada6abf269e442a6a0

Contents?: true

Size: 984 Bytes

Versions: 193

Compression:

Stored size: 984 Bytes

Contents

module Origen
  # Methods related to individual users and groups
  module Users
    autoload :User,   'origen/users/user'
    autoload :LDAP,   'origen/users/ldap'

    def app_users
      # Had to do some shenanigans here due to Origen.root not being available
      # when this file is included, only load the users from the app once a user
      # method is first called
      # return @app_users if @app_users
      # require File.join(Origen.root, 'config', 'users')
      # @app_users = users
      []
    end

    # Returns a user object representing the current user, will return a default
    # user object if the current user is not known to the generator
    def current_user
      core_id = Origen::Users::User.current_user_id
      user = app_users.find { |user| user.core_id == core_id }
      user || User.new(core_id)
    end

    # Returns all admin user objects
    def admins
      app_users.select(&:admin?)
    end
    alias_method :developers, :admins
  end
end

Version data entries

193 entries across 193 versions & 1 rubygems

Version Path
origen-0.33.2 lib/origen/users.rb
origen-0.33.1 lib/origen/users.rb
origen-0.33.0 lib/origen/users.rb
origen-0.32.1 lib/origen/users.rb
origen-0.32.0 lib/origen/users.rb
origen-0.31.0 lib/origen/users.rb
origen-0.30.0 lib/origen/users.rb
origen-0.29.0 lib/origen/users.rb
origen-0.28.2 lib/origen/users.rb
origen-0.28.1 lib/origen/users.rb
origen-0.28.0 lib/origen/users.rb
origen-0.27.0 lib/origen/users.rb
origen-0.26.0 lib/origen/users.rb
origen-0.25.1 lib/origen/users.rb
origen-0.25.0 lib/origen/users.rb
origen-0.24.0 lib/origen/users.rb
origen-0.23.0 lib/origen/users.rb
origen-0.22.0 lib/origen/users.rb
origen-0.21.0 lib/origen/users.rb
origen-0.20.3 lib/origen/users.rb