|
|
@@ -201,6 +201,25 @@ SQL;
|
|
|
return Core_AclHelper::getAclByNamespace(str_replace(':', '/', $typeName), $forceTblAclInit);
|
|
|
}
|
|
|
|
|
|
+ public static function getNamespaceFromId($idZasob) {
|
|
|
+ $sqlIdZasob = DB::getPDO()->quote($idZasob, PDO::PARAM_INT);
|
|
|
+ $zasob = DB::getPDO()->fetchFirst("
|
|
|
+ select z.ID, z.DESC, z.PARENT_ID
|
|
|
+ from CRM_LISTA_ZASOBOW z
|
|
|
+ where z.ID = {$sqlIdZasob}
|
|
|
+ and z.`TYPE` = 'TABELA'
|
|
|
+ and z.A_STATUS != 'DELETED'
|
|
|
+ ");
|
|
|
+ if (!$zasob) throw new Exception("Object not exists '{$idZasob}'");
|
|
|
+ if ($zasob['PARENT_ID'] != DB::getPDO()->getZasobId()) {
|
|
|
+ throw new Exception("TODO: getNamespaceFromId for remote database");
|
|
|
+ }
|
|
|
+ return ('default_db/' === substr($zasob['DESC'], 0, strlen('default_db/')))
|
|
|
+ ? $zasob['DESC']
|
|
|
+ : "default_db/{$zasob['DESC']}"
|
|
|
+ ;
|
|
|
+ }
|
|
|
+
|
|
|
public static function parseNamespaceUrl($namespace) {// returns assoc array: [ 'name', 'url', 'prefix', 'sourceName' ]
|
|
|
return Core_AclHelper::parseNamespaceUrl($namespace);
|
|
|
}
|