Page MenuHomePhorge

sample-insert-hosted-user_types.php
No OneTemporary

Authored By
Unknown
Size
7 KB
Referenced Files
None
Subscribers
None

sample-insert-hosted-user_types.php

#!/usr/bin/php
<?php
if (isset($_SERVER["REQUEST_METHOD"]) && !empty($SERVER["REQUEST_METHOD"])) {
die("Not intended for execution through the webserver, sorry!");
}
require_once("lib/functions.php");
$db = SQL::get_instance();
$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",
),
),
),
"form_fields" => Array(
/*
* 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(
"optional" => true,
),
"sn" => Array(),
"uid" => Array(),
"userpassword" => Array(
"type" => "password",
// "optional" => true,
),
),
"fields" => Array(
"mailquota" => "131072",
"nsroledn" => "cn=personal-user,dc=notifytest,dc=tld",
"objectclass" => Array(
"top",
"inetorgperson",
"kolabinetorgperson",
"mailrecipient",
"organizationalperson",
"person",
),
),
);
$result = $db->query("INSERT INTO `user_types` (`key`, `name`, `description`, `attributes`, `used_for`) " .
"VALUES ('personal','Personal', 'A user with a personal hosted plan'," .
"'" . 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",
),
),
),
"form_fields" => Array(
"alias" => Array(
"type" => "list",
"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(
"optional" => true,
),
"sn" => Array(),
"uid" => Array(),
"userpassword" => Array(
"type" => "password",
// "optional" => true,
),
),
"fields" => Array(
"mailquota" => "1048576",
"nsroledn" => "cn=professional-user,dc=notifytest,dc=tld",
"objectclass" => Array(
"top",
"inetorgperson",
"kolabinetorgperson",
"mailrecipient",
"organizationalperson",
"person",
),
),
);
$result = $db->query("INSERT INTO `user_types` (`key`, `name`, `description`, `attributes`, `used_for`) " .
"VALUES ('professional','Professional', 'A user with a professional hosted plan'," .
"'" . json_encode($attributes) . "', 'hosted')");
?>

File Metadata

Mime Type
text/x-php
Expires
Sat, Apr 4, 8:37 AM (2 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ec/bb/e9dbcfe27fa68033dbbe763bd491
Default Alt Text
sample-insert-hosted-user_types.php (7 KB)

Event Timeline