/** * Get realm info and permissions * * This method returns an array based tree structure. It is defined as * follows: * - Each element represents realm, and is indexed by the realm name. * - Each element contains an array of its child realms. * - In addition to an array of child realms, each element contains an * element indexed by the string "_DETAILS_". This element is an array * of a format similar too: * * [_DETAILS_] => Array * ( * [realmid] => 3 * [name] => Modify * [parentid] => 1 * [description] => Administration modification realm * [userallow] => - (only present if $group=false) * [groupallow] => - * ) * * @param int $guid The group or user id on which the [groupallow] (and [userallow] in case of users) info is based * @param boolean $group True/False if the structure should describe group/users permissions respectively * * */ public static function buildRealmTree($guid, $group) { global $cfg; $db = Database::getInstance($cfg['Auth']['dsn']); $sql = "SELECT * FROM realms ORDER BY parentid"; $data = $db->getAll($sql); return AuthUtil::recBuildRealmTree($data, array(0), array(), $guid, $group); }