I18N Pretty Names
OpenACS has a wonderful I18N support for the code, so you can actually have the displayed code in multiple languages. Sadly, it lacks the same level of support for content. This is especially inconvenient if we are dealing with content that is actually a label or a pretty_name. This was until the advent of acs-translations and lang::util::convert_to_i18n.
If you are translating a pretty_name or a label which does have an additional name (e.g. acs-attributes has an attribute_name plus a pretty_name), and you deal with acs-objects, then live is easy.
-
Get the next ID from the acs-objects using [db_nextval acs_object_id_seq]
-
set the pretty_name to an I18N language string using convert_to_i18n
set pretty_name [lang::util::convert_to_i18n -message_key "ams_option_${object_id}" -text "$pretty_name"]
- Insert the ams_option (just as an example, works differently) using something like ams::option::new -option_id $object_id -pretty_name $pretty_name ....
This should do the trick. Sadly, there is more to it. In some situations you are not dealing with acs-objects (e.g. you are dealing with acs-attributes). Then the sequence is different.
- Insert the attribute normally, but regain the attribute_id
-
set the pretty_name to an I18N language string using convert_to_i18n
set pretty_name [lang::util::convert_to_i18n -message_key "acs_attribute_${object_id}" -text "$pretty_name"]
- Update the acs-attributes table to the new I18N version of the pretty name using "db_dml ...."
If you have a name/label, where the table does not contain an additional pretty_name (like groups), then you have to rely on the acs-objects title to do the trick for you.
Caching
As a general rule, if you do util_memoize for a procedure make sure the procedure calls the not cached versions of the all subprocedures as you would otherwise end up with caching done multiple times.
Install Openldap and ns_ldap
Installed OpenLDAP and ns_ldap as per instructions:
http://openacs.org/doc/openacs-5-1/install-ldap-radius.html
(NOTE: When installing ns_ldap, you must ensure that the environment vaiable AOLSERVER is set.)
Edit ldap.conf
Edited /usr/local/openldap/etc/openldap/ldap.conf
and /etc/ldap.conf
Added the lines:
host [IP Address]
base dc=[mydomain],dc=com
Test with ldapsearch
At this stage I was able to do an ldapsearch command, great!:
ldapsearch -x ""
or
ldapsearch -x -v -h [IP Address] "" -s base '(objectclass=*)'
dotLRN changes:
I Installed the following services in dotLRN:
Authentication 5.1.4
LDAP Authentication Driver 1.0d2
Downloaded auth-ldap-procs.tcl version 1.9.2.1 from here
http://cvs.openacs.org/cvs/*checkout*/openacs-4/packages/auth-ldap/tcl/auth-ldap-procs.tcl?rev=1.9.2.1
Edited the file:
Changed
from
set ldap_bind_p 0
to
set ldap_bind_p 1
(uncomment)
from
#set cn $username
to
set cn $username
(change)
from
if {[ns_ldap bind $lh "cn=$cn" "$password"]} {
to
set fdn [lindex [lindex [ns_ldap search $lh -scope subtree $params(BaseDN) "($params(UsernameAttribute)=$username)" dn] 0] 1]
ns_log Debug "FDN: $fdn"
if {[ns_ldap bind $lh $fdn $password]} {
(new line)
from
# We do not check LDAP account status
set result(account_status) ok
return [array get result]
to
# We do not check LDAP account status
set result(account_status) ok
ns_log Notice "FDN [array get result]"
return [array get result]
Edit run file an config.tcl
Edit the run file under
[dotlrn]/etc/daemontools
Before the exec command enter
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/openldap/lib
export LD_LIBRARY_PATH
Edit the config.tcl file
Remove the '#' in front of the line
ns_param nsldap ${bindir}/nsldap.so
Add the following to the end of the file:
ns_param user "cn=[user],ou=[AD Dir],dc=[mydomain],dc=com"
ns_param password "[password]"
ns_param host "[IP Address]"
ns_param connections 2
ns_param verbose On
#
# ldap pools
#
ns_section "ns/ldap/pools"
ns_param ldap ldap
#
# ldap default pool
#
ns_section ns/server/${server}/ldap
ns_param Pools *
ns_param DefaultPool ldap
Create new authority under http://[mydomain]/acs-admin/auth/
Change the users default Authority to LDAP
