diff --git a/doc/sample-insert-hosted-user_types.php b/doc/sample-insert-hosted-user_types.php --- a/doc/sample-insert-hosted-user_types.php +++ b/doc/sample-insert-hosted-user_types.php @@ -1,7 +1,11 @@ #!/usr/bin/php query("TRUNCATE TABLE `user_types`"); + $result = $db->query("TRUNCATE `user_types`"); $attributes = Array( - - /* - * The form fields for which the values can be - * generated automatically, using the existing - * values of form_fields - */ "auto_form_fields" => Array( - /* - * The 'cn' attribute is required for - * the LDAP objectclasses we use, but - * can be composed from a 'givenname' - * and 'sn' attribute form_field (of - * which 'sn' is also a required - * attribute. - */ "cn" => Array( "data" => Array( "givenname", "sn", ), ), - /* - * The 'mail' attribute is supposed to - * contain the email address this user - * will use for this environment, and - * is (supposed?) to match the 'uid' - * for the user account. - * - * Disable this auto_form_field if - * the API is not capable of making - * a 'uid' become a 'uid'@'domain', - * where 'domain' is not a valid - * LDAP attribute for a user entry. - */ "mail" => Array( "data" => Array( "uid", ), ), + "nsroledn" => Array( + "optional" => true, + ), ), "form_fields" => Array( - /* - * Givenname is a requirement, but could - * be filled with random data if not - * wanted. - */ + "title" => Array( + "optional" => true, + ), "givenname" => Array(), - /* - * The 'mailalternateaddress' is supposed - * to contain the original email address - * for the user. - */ + "sn" => Array(), + "o" => Array( + "optional" => true, + ), + "street" => Array( + "optional" => true, + ), + "postalcode" => Array( + "optional" => true, + ), + "l" => Array( + "optional" => true, + ), + "c" => Array( + "type" => "select", + "value" => "normal", + ), + "telephonenumber" => Array( + "optional" => true, + ), + "mobile" => Array( + "optional" => true, + ), "mailalternateaddress" => Array( + "optional" => false, + ), + "alias" => Array( + "type" => "list", + "optional" => true, + ), + "uid" => Array( "optional" => true, ), + "userpassword" => Array( + "type" => "password", + "optional" => true, + ), + "nsroledn" => Array( + "optional" => true, + ), + ), + "fields" => Array( + "mailquota" => Array(), + "objectclass" => Array( + "top", + "inetorgperson", + "kolabinetorgperson", + "mailrecipient", + "organizationalperson", + "country", + "person", + ), + ), + ); + + $result = $db->query("INSERT INTO `user_types` (`key`, `name`, `description`, `attributes`, `used_for`) " . + "VALUES ('individual','individual', 'individual'," . + "'" . json_encode($attributes) . "', 'hosted')"); + + $attributes = Array( + "auto_form_fields" => Array( + "cn" => Array( + "data" => Array( + "givenname", + "sn", + ), + ), + "nsroledn" => Array( + "optional" => true, + ), + ), + "form_fields" => Array( + "givenname" => Array(), "sn" => Array(), + "o" => Array( + "optional" => true, + ), + "street" => Array( + "optional" => true, + ), + "postalcode" => Array( + "optional" => true, + ), + "l" => Array( + "optional" => true, + ), + "c" => Array( + "type" => "select", + "value" => "normal", + ), + "telephonenumber" => Array( + "optional" => true, + ), + "mobile" => Array( + "optional" => true, + ), + "mail" => Array( + "validate" => false, + ), + "mailalternateaddress" => Array(), + "nsroledn" => Array( + "optional" => true, + ), "uid" => Array(), "userpassword" => Array( + "optional" => true, "type" => "password", -// "optional" => true, ), ), "fields" => Array( - "mailquota" => "131072", - "nsroledn" => "cn=personal-user,dc=notifytest,dc=tld", + "mailquota" => Array(), + "nsroledn" => Array( + "cn=admin-user,%(base_dn)s", + ), "objectclass" => Array( "top", "inetorgperson", "kolabinetorgperson", - "mailrecipient", "organizationalperson", + "mailrecipient", + "country", "person", ), ), ); + $result = $db->query("INSERT INTO `user_types` (`key`, `name`, `description`, `attributes`, `used_for`) " . - "VALUES ('personal','Personal', 'A user with a personal hosted plan'," . + "VALUES ('organization','organization', 'organization'," . "'" . json_encode($attributes) . "', 'hosted')"); $attributes = Array( - /* - * The form fields for which the values can be - * generated automatically, using the existing - * values of form_fields - */ "auto_form_fields" => Array( - /* - * The 'cn' attribute is required for - * the LDAP objectclasses we use, but - * can be composed from a 'givenname' - * and 'sn' attribute form_field (of - * which 'sn' is also a required - * attribute. - */ "cn" => Array( "data" => Array( "givenname", "sn", ), ), - /* - * The 'mail' attribute is supposed to - * contain the email address this user - * will use for this environment, and - * is (supposed?) to match the 'uid' - * for the user account. - * - * Disable this auto_form_field if - * the API is not capable of making - * a 'uid' become a 'uid'@'domain', - * where 'domain' is not a valid - * LDAP attribute for a user entry. - */ "mail" => Array( "data" => Array( "uid", ), ), + "nsroledn" => Array( + "optional" => true, + ), ), "form_fields" => Array( - "alias" => Array( - "type" => "list", + "title" => Array( "optional" => true, - "maxcount" => 2, ), - /* - * Givenname is a requirement, but could - * be filled with random data if not - * wanted. - */ "givenname" => Array(), - /* - * The 'mailalternateaddress' is supposed - * to contain the original email address - * for the user. - */ - "mailalternateaddress" => Array( + "sn" => Array(), + "o" => Array( + "optional" => true, + ), + "street" => Array( + "optional" => true, + ), + "postalcode" => Array( + "optional" => true, + ), + "l" => Array( + "optional" => true, + ), + "telephonenumber" => Array( + "optional" => true, + ), + "mobile" => Array( + "optional" => true, + ), + "alias" => Array( + "type" => "list", "optional" => true, ), - "sn" => Array(), - "uid" => Array(), "userpassword" => Array( "type" => "password", -// "optional" => true, + "optional" => true, + ), + "uid" => Array( + "optional" => true, + ), + "nsroledn" => Array( + "optional" => true, ), ), "fields" => Array( - "mailquota" => "1048576", - "nsroledn" => "cn=professional-user,dc=notifytest,dc=tld", + "mailquota" => Array(), "objectclass" => Array( "top", "inetorgperson", @@ -174,7 +238,76 @@ ); $result = $db->query("INSERT INTO `user_types` (`key`, `name`, `description`, `attributes`, `used_for`) " . - "VALUES ('professional','Professional', 'A user with a professional hosted plan'," . + "VALUES ('organization-user','organization-user', 'organization-user'," . "'" . json_encode($attributes) . "', 'hosted')"); + $attributes = Array( + "auto_form_fields" => Array( + "cn" => Array( + "data" => Array( + "givenname", + "sn", + ), + ), + "mail" => Array( + "data" => Array( + "uid", + ), + ), + "nsroledn" => Array( + "optional" => true, + ), + ), + "form_fields" => Array( + "title" => Array( + "optional" => true, + ), + "givenname" => Array(), + "sn" => Array(), + "o" => Array( + "optional" => true, + ), + "street" => Array( + "optional" => true, + ), + "postalcode" => Array( + "optional" => true, + ), + "l" => Array( + "optional" => true, + ), + "telephonenumber" => Array( + "optional" => true, + ), + "mobile" => Array( + "optional" => true, + ), + "nsroledn" => Array( + "optional" => true, + ), + "userpassword" => Array( + "type" => "password", + "optional" => true, + ), + "uid" => Array( + "optional" => true, + ), + ), + "fields" => Array( + "objectclass" => Array( + "top", + "inetorgperson", + "kolabinetorgperson", + "organizationalperson", + "person", + ), + ), + ); + + $result = $db->query("INSERT INTO `user_types` (`key`, `name`, `description`, `attributes`, `used_for`) " . + "VALUES ('tenant-admin','tenant-admin', 'tenant-admin'," . + "'" . json_encode($attributes) . "', '')"); + + + ?>