Module: ActiveSambaLdap::GroupEntry
- Included in:
- Group
- Defined in:
- lib/active_samba_ldap/group_entry.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #change_gid_number(gid, allow_non_unique = false) ⇒ Object
- #destroy(options = {}) ⇒ Object
- #fill_default_values(options = {}) ⇒ Object
- #members ⇒ Object
- #primary_members ⇒ Object
- #reload_members ⇒ Object
- #reload_primary_members ⇒ Object
Class Method Details
.included(base) ⇒ Object
7 8 9 10 |
# File 'lib/active_samba_ldap/group_entry.rb', line 7 def self.included(base) super base.extend(ClassMethods) end |
Instance Method Details
#change_gid_number(gid, allow_non_unique = false) ⇒ Object
128 129 130 131 |
# 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 = {}) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/active_samba_ldap/group_entry.rb', line 133 def destroy(={}) if [:remove_members] if [:force_change_primary_members] change_primary_members() 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 = {}) ⇒ Object
103 104 105 106 107 108 |
# File 'lib/active_samba_ldap/group_entry.rb', line 103 def fill_default_values(={}) = .stringify_keys gid_number = ["gid_number"] change_gid_number(gid_number) if gid_number self.description ||= ["description"] || cn end |
#members ⇒ Object
110 111 112 |
# File 'lib/active_samba_ldap/group_entry.rb', line 110 def members users.to_ary + computers.to_ary end |
#primary_members ⇒ Object
119 120 121 |
# File 'lib/active_samba_ldap/group_entry.rb', line 119 def primary_members primary_users.to_ary + primary_computers.to_ary end |
#reload_members ⇒ Object
114 115 116 117 |
# File 'lib/active_samba_ldap/group_entry.rb', line 114 def reload_members users.reload computers.reload end |
#reload_primary_members ⇒ Object
123 124 125 126 |
# File 'lib/active_samba_ldap/group_entry.rb', line 123 def reload_primary_members primary_users.reload primary_computers.reload end |