Ejemplo n.º 1
0
    /**
     * Export access control list to a string
     * @param array accessControlList access controllist
     * @param boolean echoExport print the exported value
     *      if set to true (default true)
     * @return string string representation of the access control list
     */
    static function exportACL($accessControlList, $echoExport = true) {
        $export = "<pre>\n";
        $prefixList = WikiAccessControl::prefixList();
        $privilegeList = WikiAccessControl::privilegeList();

        foreach ($prefixList as $accessLevel => $prefix) {
            $export .= $accessLevel . ':';

            foreach ($privilegeList as $privilege) {
                $aclKey = $prefix . $privilege;

                $boolValue = ( $accessControlList[$aclKey] == true ) ? 'true' : 'false';
                $export .= $privilege . '(' . $boolValue . ')';
            }

            $export .= "<br />\n";
        }

        $export .= "</pre>\n";

        if ($echoExport == true) {
            echo $export;
        }

        return $export;
    }