UserMsgsTrashStorageAcl.php 1021 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. Lib::loadClass('Core_AclSimpleSchemaBase');
  3. Lib::loadClass('Schema_UserMsgsStorageAcl');
  4. Lib::loadClass('ParseOgcFilter');
  5. class Schema_UserMsgsTrashStorageAcl extends Schema_UserMsgsStorageAcl {
  6. function _parseSqlWhere($params = []) {
  7. $sqlWhereAnd = [];
  8. $sqlWhereAnd[] = " m.`uiTargetType` = 'default_db_table_record' ";
  9. $sqlUserLogin = DB::getPDO()->quote($this->login);
  10. $idGroupList = $this->_getUserIdGroupList();
  11. if (empty($idGroupList)) throw new Exception("Brak przypisanych grup do użytkownika");
  12. $sqlIdGroupsCsv = implode(",", $idGroupList);
  13. $sqlWhereAnd[] = "
  14. (
  15. m.`A_RECORD_CREATE_AUTHOR` = {$sqlUserLogin}
  16. or ( m.`userTargetType` in('everyone')
  17. or ( m.`userTargetType`='user' and m.`userTargetName` = {$sqlUserLogin} )
  18. or ( m.`userTargetType`='group' and m.`userTargetName` in( {$sqlIdGroupsCsv} ) )
  19. )
  20. )
  21. ";
  22. $sqlWhereAnd[] = " m.`A_STATUS` in('OFF_HARD', 'DELETED') ";
  23. // TODO: parse where/ogc, etc.
  24. return implode(" and ", $sqlWhereAnd);
  25. }
  26. }