summaryrefslogtreecommitdiff
path: root/doc/sample-insert-ou_types.php
blob: 0dd7b291c1de87281f58dbe85c8fe3dc0e93e9ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/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 TABLE `ou_types`");

    $attributes = Array(
            "auto_form_fields" => Array(
                ),
            "fields" => Array(
                    "objectclass" => Array(
                            "top",
                            "organizationalunit",
                        ),
                ),
            "form_fields" => Array(
                    "ou" => Array(),
                    "description" => Array(
                        "optional" => true,
                    ),
                ),
        );

    $result = $db->query("INSERT INTO `ou_types` (`key`, `name`, `description`, `attributes`) " .
                "VALUES ('simple_managed','Standard Organizational Unit', 'A standard organizational unit definition'," .
                "'" . json_encode($attributes) . "')");

?>