Sha256: d03d54b82ebdafb865c4ce498a01cfb9eccf00d53c92e784a69ce5dcf50daa69

Contents?: true

Size: 720 Bytes

Versions: 38

Compression:

Stored size: 720 Bytes

Contents

require 'objects/group'

class User < ActiveLdap::Base
  ldap_mapping :dn_attribute => 'uid', :prefix => 'ou=People',
               :classes => ['person', 'posixAccount']
  belongs_to :primary_group, :class_name => "Group",
             :foreign_key => "gidNumber", :primary_key => "gidNumber"
  belongs_to :groups, :many => 'memberUid'

  # An example of using the old "return_objects" API with the
  # new ActiveRecord-style API.
  alias groups_mapping groups
  def groups(return_objects=true)
    return groups_mapping if return_objects
    attr = 'cn'
    Group.search(:attribute => 'memberUid',
                 :value => id,
                 :attributes => [attr]).map {|dn, attrs| attrs[attr]}.flatten
  end
end

Version data entries

38 entries across 38 versions & 3 rubygems

Version Path
activeldap-7.2.1 examples/objects/user.rb
activeldap-7.2.0 examples/objects/user.rb
activeldap-7.0.0 examples/objects/user.rb
activeldap-6.1.0 examples/objects/user.rb
activeldap-6.0.4 examples/objects/user.rb
activeldap-6.0.3 examples/objects/user.rb
activeldap-6.0.2 examples/objects/user.rb
activeldap-6.0.1 examples/objects/user.rb
activeldap-6.0.0 examples/objects/user.rb
activeldap-5.2.4 examples/objects/user.rb
activeldap-5.2.3 examples/objects/user.rb
activeldap-5.2.2 examples/objects/user.rb
activeldap-5.2.1 examples/objects/user.rb
activeldap-5.2.0 examples/objects/user.rb
activeldap-5.1.1 examples/objects/user.rb
activeldap-5.1.0 examples/objects/user.rb
activeldap-3.2.3 examples/objects/user.rb
powerhome-activeldap-3.2.3 examples/objects/user.rb
activeldap-4.0.6 examples/objects/user.rb
activeldap-4.0.5 examples/objects/user.rb