summaryrefslogtreecommitdiff
path: root/doc/sample-insert-role_types.php
blob: a04ef74147efafa3063cba550269b612419492bb (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
36
#!/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 `role_types`");

    $attributes = Array(
            "auto_form_fields" => Array(
                ),
            "fields" => Array(
                    "objectclass" => Array(
                            "top",
                            "ldapsubentry",
                            "nsroledefinition",
                            "nssimpleroledefinition",
                            "nsmanagedroledefinition"
                        ),
                ),
            "form_fields" => Array(
                    "cn" => Array(),
                    "description" => Array(),
                ),
        );

    $result = $db->query("INSERT INTO `role_types` (`key`, `name`, `description`, `attributes`) " .
                "VALUES ('simple_managed','Standard Role', 'A standard role definition'," .
                "'" . json_encode($attributes) . "')");

?>