|
|
@@ -23,6 +23,26 @@ class Core_AclHelper {// Helper class for Acl
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ // @returns array [ field => string(perms like 'RWX') ]
|
|
|
+ public static function getFieldPerms($acl) {// TODO: fetch perms for given Acl by namespace
|
|
|
+ // TODO:? cache session or only current request (static)
|
|
|
+ $fieldPerms = array();
|
|
|
+ foreach ($acl->getFields() as $idField => $field) {
|
|
|
+ $fieldPerms[ $field['name'] ] = $field['perms'];
|
|
|
+ }
|
|
|
+ return $fieldPerms;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function getExportFieldList($acl) {
|
|
|
+ $exportFields = array();
|
|
|
+ foreach (self::getFieldPerms($acl) as $fieldName => $perms) {
|
|
|
+ if (false !== strpos($perms, 'E')) {
|
|
|
+ $exportFields[] = $fieldName;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $exportFields;
|
|
|
+ }
|
|
|
+
|
|
|
public static function getAclByNamespace($namespace, $forceTblAclInit = false) {
|
|
|
if ('http' != substr($namespace, 0, 4)) $namespace = Api_WfsNs::getBaseWfsUri() . '/' . $namespace;//Request::getHostUri() . '/' . $namespace;
|
|
|
|
|
|
@@ -188,4 +208,27 @@ class Core_AclHelper {// Helper class for Acl
|
|
|
return $rowFunList;
|
|
|
}
|
|
|
|
|
|
+ public static function getAclList() {// @usage Core_AclHelper::getAclList();// @returns array [ $typeName , ... ]
|
|
|
+ $aclList = array();
|
|
|
+ // Schema_AccessGroupStorageAcl, load by User::getAcl()->getObjectAcl('objects', $objName);
|
|
|
+ // $objClassName = "Schema_{$objName}StorageAcl";
|
|
|
+ // if (!Lib::tryLoadClass($objClassName)) throw new HttpException("Not implemented", 501);
|
|
|
+ // $ grep -r 'class ' SE/se-lib/Schema/*Acl.php
|
|
|
+ // SE/se-lib/Schema/AccessGroupStorageAcl.php:class Schema_AccessGroupStorageAcl extends Core_AclBase {// Read only class
|
|
|
+ // SE/se-lib/Schema/AccessOwnerStorageAcl.php:class Schema_AccessOwnerStorageAcl extends Core_AclBase {
|
|
|
+ // SE/se-lib/Schema/FileStorageAcl.php:class Schema_FileStorageAcl extends Core_AclBase {
|
|
|
+ // SE/se-lib/Schema/KorespondencjaStorageAcl.php:class Schema_KorespondencjaStorageAcl extends Core_AclBase {
|
|
|
+ // SE/se-lib/Schema/TestPermsStorageAcl.php:class Schema_TestPermsStorageAcl extends Core_AclBase {
|
|
|
+ $aclList[] = 'default_objects:AccessGroup';
|
|
|
+ $aclList[] = 'default_objects:AccessOwner';
|
|
|
+ $aclList[] = 'default_objects:File';
|
|
|
+ $aclList[] = 'default_objects:Korespondencja';
|
|
|
+ $aclList[] = 'default_objects:TestPerms';
|
|
|
+
|
|
|
+ // TODO: read from Database
|
|
|
+ $aclList[] = 'default_db__x3A__TEST_PERMS:TEST_PERMS';// uproszczona wersja: default_db:TEST_PERMS
|
|
|
+
|
|
|
+ return $aclList;
|
|
|
+ }
|
|
|
+
|
|
|
}
|