2.3 LDAP

2.3.1 Resource Representations

GroupSynchronization


{
   "register": boolean,
   "sync_profiles": boolean,
   "sync_membership": boolean,
   "delete_removed_groups": boolean  
}

LdapHomeDirConfig


{
   "type": string ("custom_net_folder", "home_dir_attribute", "custom_attribute" or "none"),
   "net_folder_server": LongIdLinkPair Resource,
   "path": string,
   "ldap_attribute": string
} 

LdapSearchInfo


{
   "base_dn": string,
   "filter": string,
   "search_subtree": boolean,
   "home_dir_config": LdapHomeDirConfig Resource
} 

LdapSyncResults


{
   "status": string ("STATUS_COLLECT_RESULTS", "STATUS_COMPLETED", "STATUS_STOP_COLLECTING_RESULTS", 
                     "STATUS_ABORTED_BY_ERROR" or "STATUS_SYNC_ALREADY_IN_PROGRESS"),
   "added_users": [ string ],
   "modified_users": [ string ],
   "deleted_users": [ string ],
   "disabled_users": [ string ],
   "added_groups": [ string ],
   "modified_groups": [ string ],
   "deleted_groups": [ string ]   
}

LdapUserSource


{
   "id": string,
   "url": string,
   "username_attribute": string,
   "guid_attribute": string,
   "attribute_map": [
      KeyValuePair Resource
   ],
   "user_contexts": [
      LdapSearchInfo Resource
   ],
   "group_contexts": [
      LdapSearchInfo Resource
   ],
   "username": string,
   "password": string
}         

UserSourceSynchronization


{
   "users": UserSynchronization Resource,
   "groups": GroupSynchronization Resource,
   "schedule": Schedule Resource
}   

UserSynchronization


{
   "register": boolean,
   "sync_profiles": boolean,
   "remove_account_action: string ("disable" or "delete"),
   "delete_workspace": boolean,
   "default_timezone": string,
   "default_locale": string
}   

2.3.2 List

To list all LDAP user sources, use the “user_sources” related link (href: "/admin/user_sources") from the root admin resource (href: "/admin"):


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/user_sources

[Response]
{
   "first":0,
   "count":1,
   "total":1,
   "items":[{
      "id":"09c1c3fb518cf1a001518d01a2b70014",
      "url":"ldap://intlab79.lab.novell.com:389",
      "type":"ldap",
      "href":"/admin/user_sources/09c1c3fb518cf1a001518d01a2b70014",
      "username_attribute":"cn",
      "guid_attribute":"GUID",
      "attribute_map":[{
         "key":"gn",
         "value":"firstName"
      },{
         "key":"mail",
         "value":"emailAddress"
      },{
         "key":"sn",
         "value":"lastName"
      },{
         "key":"description",
         "value":"description"
      },{
         "key":"telephoneNumber",
         "value":"phone"
      },{
         "key":"surname",
         "value":"lastName"
      },{
         "key":"givenName",
         "value":"firstName"
      }],
      "user_contexts":[{
         "filter":"(&(!(objectClass=computer))(|(objectClass=Person)(objectClass=orgPerson)(objectClass=inetOrgPerson)))",
         "base_dn":"o=novell",
         "search_subtree":false,
         "home_dir_config":{
            "type":"home_dir_attribute"
         }
      }],
      "group_contexts":[{
         "filter":"(|(objectClass=group)(objectClass=groupOfNames)(objectClass=groupOfUniqueNames))",
         "base_dn":"o=novell",
         "search_subtree":false
      }],
      "username":"cn=superuser,o=novell"
   }]
}

2.3.3 Create

To create a new LDAP user source, POST an LdapUserSource object to the “user_sources” related link (href: "/admin/user_sources") from the root admin resource (href: "/admin"):


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/user_sources \
  -X POST -H "Content-Type: application/json" \
  -d '{"url":"ldap://intlab79.lab.novell.com:389","username_attribute":"cn","guid_attribute":"GUID",
       "username":"cn=superuser,o=novell","password":"pwd",
       "user_contexts":[{"base_dn":"o=novell","home_dir_config":{"type":"home_dir_attribute"}}],
       "group_contexts":[{"base_dn":"o=novell"}]}'
   
[Response]
{
...(Full LdapUserSource object)
}     

2.3.4 Delete


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/user_sources/09c1c3fb518cf1a001518d01a2b70014 -X DELETE

[Empty Response] 

2.3.5 Sync Config

Get Settings

To get the LDAP Sync Config settings, use the user_source_sync_config related link (href: “/admin/user_sources/sync_config") from the root admin resource (href: "/admin"):


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/user_sources/sync_config

[Response]
{
   "users":{
      "register":true,
      "sync_profiles":true,
      "removed_account_action":"disable",
      "default_timezone":"GMT",
      "default_locale":"en_US"
   },
   "groups":{
      "register":true,
      "sync_profiles":true,
      "sync_membership":true,
      "delete_removed_groups":false
   },
   "schedule":{
      "enabled":false,
      "at":{
         "hour":12,
         "minute":15
      },
      "when":"daily"
   }
}

Modify Settings

To modify the LDAP Sync Config settings, PUT a UserSourceSynchronization object to the user_source_sync_config related link (href: “/admin/user_sources/sync_config") from the root admin resource (href: "/admin").  Only the attributes that are specified in the request body are updated.


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/user_sources/sync_config \
  -X PUT -H "Content-Type: application/json" -d '{"schedule":{"enabled":true}}' 

[Response]
{
...(Full UserSourceSynchronization object)
}    

2.3.6 Sync

To sync all LDAP user sources, make a POST request to the "user_sources_sync" related link (href: "/admin/user_sources/sync") from the root admin resource (href: "/admin"):


[Request]
> curl -k -u admin:novell https://amethyst.provo.novell.com:8443/rest/admin/user_sources/sync -X POST

[Response]
{
   "status":"STATUS_COLLECT_RESULTS",
   "added_users":[],
   "modified_users":[],
   "deleted_users":[],
   "disabled_users":[],
   "added_groups":[],
   "modified_groups":[],
   "deleted_groups":[]
}