[activeldap-discuss] Groups are created in the wrong location
MR-Mencel at wiu.edu
MR-Mencel at wiu.edu
Fri Jan 8 09:56:53 EST 2010
Yes....looks like I can override ldap_mapping in the method....as this example works...
class AdGroup < AdBase
ldap_mapping :dn_attribute => "cn",
:prefix => "ou=wiu",
:classes => ['top','group']
has_many :members, :class_name => "AdUser", :wrap => "member", :primary_key => 'distinguishedName'
def self.add_course_group(starnum)
ldap_mapping :dn_attribute => "cn",
:prefix => "OU=CLASSES,OU=STUDENTS,ou=wiu",
:classes => ['top','group']
group = AdGroup.new(starnum)
group.dn = "cn=#{starnum},OU=CLASSES,OU=STUDENTS,ou=wiu,dc=ad,dc=wiu,dc=edu"
group.cn = starnum
group.distinguishedName = "CN=#{starnum},OU=CLASSES,OU=STUDENTS,OU=WIU,DC=ad,DC=wiu,DC=edu"
group.name = starnum
group.objectCategory = "CN=Group,CN=Schema,CN=Configuration,DC=ad,DC=wiu,DC=edu"
group.groupType = "-2147483646"
group.add_class('group')
group.sAMAccountName = starnum
unless group.save
puts "save failed"
puts group.errors.full_messages
exit 1
end
return group
end
If there is an easier or better way....let me know.
Thanks,
Matt
----- Original Message -----
From: "Matt Mencel" <MR-Mencel at wiu.edu>
To: ruby-activeldap-discuss at rubyforge.org
Sent: Friday, January 8, 2010 8:15:22 AM GMT -06:00 US/Canada Central
Subject: Re: [activeldap-discuss] Groups are created in the wrong location
This is going to be a bigger problem when I start to create users as they are all over the place in our directory. Can I override ldap_mapping at the moment that I save a group or user object?
Matt
----- Original Message -----
From: "Matt Mencel" <MR-Mencel at wiu.edu>
To: ruby-activeldap-discuss at rubyforge.org
Sent: Thursday, January 7, 2010 11:14:37 PM GMT -06:00 US/Canada Central
Subject: [activeldap-discuss] Groups are created in the wrong location
Hi,
I've got a code snippet below. I am trying to create group objects in the following location...
OU=CLASSES,OU=STUDENTS,OU=WIU,DC=AD,DC=WIU,DC=EDU
But they are getting created here instead...
OU=WIU,DC=AD,DC=WIU,DC=EDU
...not deeper in the tree where I want them. I have the prefix in my ldap_mapping set at the root OU=WIU, but I was hoping that by defining the full group.dn and group.distinguishedName when I save the group....that it would create it where I specified with the distinguishedName attribute. Apparently that is not the case. Can anyone tell me what I'm doing wrong?
Thanks,
Matt
class AdGroup < AdBase
ldap_mapping :dn_attribute => "cn",
:prefix => "ou=wiu",
:classes => ['top','group']
has_many :members, :class_name => "AdUser", :wrap => "member", :primary_key => 'distinguishedName'
def self.add_course_group(starnum)
group = AdGroup.new(starnum)
group.dn = "cn=#{starnum},OU=CLASSES,OU=STUDENTS,ou=wiu,dc=ad,dc=wiu,dc=edu"
group.cn = starnum
group.distinguishedName = "CN=#{starnum},OU=CLASSES,OU=STUDENTS,OU=WIU,DC=ad,DC=wiu,DC=edu"
group.name = starnum
group.objectCategory = "CN=Group,CN=Schema,CN=Configuration,DC=ad,DC=wiu,DC=edu"
group.groupType = "-2147483646"
group.add_class('group')
group.sAMAccountName = starnum
unless group.save
puts "save failed"
puts group.errors.full_messages
exit 1
end
return group
end
_______________________________________________
ruby-activeldap-discuss mailing list
ruby-activeldap-discuss at rubyforge.org
http://rubyforge.org/mailman/listinfo/ruby-activeldap-discuss
_______________________________________________
ruby-activeldap-discuss mailing list
ruby-activeldap-discuss at rubyforge.org
http://rubyforge.org/mailman/listinfo/ruby-activeldap-discuss
More information about the ruby-activeldap-discuss
mailing list