Class Index [+]

Quicksearch

ActiveSambaLdap::GroupEntry

Public Class Methods

included(base) click to toggle source

(Not documented)

# File lib/active_samba_ldap/group_entry.rb, line 7
    def self.included(base)
      super
      base.extend(ClassMethods)
    end

Public Instance Methods

change_gid_number(gid, allow_non_unique=false) click to toggle source

(Not documented)

# File lib/active_samba_ldap/group_entry.rb, line 128
    def change_gid_number(gid, allow_non_unique=false)
      check_unique_gid_number(gid) unless allow_non_unique
      self.gid_number = gid
    end
destroy(options={}) click to toggle source

(Not documented)

# File lib/active_samba_ldap/group_entry.rb, line 133
    def destroy(options={})
      if options[:remove_members]
        if options[:force_change_primary_members]
          change_primary_members(options)
        end
        reload_primary_members
        unless primary_members.empty?
          not_destroyed_members = primary_members.collect {|x| x.uid}
          raise PrimaryGroupCanNotBeDestroyed.new(cn, not_destroyed_members)
        end
        self.users = []
        self.computers = []
      end
      super()
    end
fill_default_values(options={}) click to toggle source

(Not documented)

# File lib/active_samba_ldap/group_entry.rb, line 103
    def fill_default_values(options={})
      options = options.stringify_keys
      gid_number = options["gid_number"]
      change_gid_number(gid_number) if gid_number
      self.description ||= options["description"] || cn
    end
members() click to toggle source

(Not documented)

# File lib/active_samba_ldap/group_entry.rb, line 110
    def members
      users.to_ary + computers.to_ary
    end
primary_members() click to toggle source

(Not documented)

# File lib/active_samba_ldap/group_entry.rb, line 119
    def primary_members
      primary_users.to_ary + primary_computers.to_ary
    end
reload_members() click to toggle source

(Not documented)

# File lib/active_samba_ldap/group_entry.rb, line 114
    def reload_members
      users.reload
      computers.reload
    end
reload_primary_members() click to toggle source

(Not documented)

# File lib/active_samba_ldap/group_entry.rb, line 123
    def reload_primary_members
      primary_users.reload
      primary_computers.reload
    end

Private Instance Methods

change_primary_members(options={}) click to toggle source

(Not documented)

# File lib/active_samba_ldap/group_entry.rb, line 166
    def change_primary_members(options={})
      name = cn

      pr_members = primary_members
      cannot_removed_members = []
      pr_members.each do |member|
        if (member.groups.collect {|group| group.cn} - [name]).empty?
          cannot_removed_members << member.uid
        end
      end
      unless cannot_removed_members.empty?
        raise CanNotChangePrimaryGroup.new(name, cannot_removed_members)
      end

      pr_members.each do |member|
        new_group = member.groups.find {|gr| gr.cn != name}
        member.primary_group = new_group
        member.save!
      end
    end
check_unique_gid_number(gid_number) click to toggle source

(Not documented)

# File lib/active_samba_ldap/group_entry.rb, line 158
    def check_unique_gid_number(gid_number)
      ActiveSambaLdap::Base.restart_nscd do
        if self.class.find_by_gid_number(gid_number)
          raise GidNumberAlreadyExists.new(gid_number)
        end
      end
    end
ensure_uid(member_or_uid) click to toggle source

(Not documented)

# File lib/active_samba_ldap/group_entry.rb, line 150
    def ensure_uid(member_or_uid)
      if member_or_uid.is_a?(String)
        member_or_uid
      else
        member_or_uid.uid
      end
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.