add stamp / no-stamp to export-by-email and export-by-ftp (#4437)

add default (disabled) stamp settings on new collections
add "record_edit" & "image_tools" to conf / export-stamp-choice privilege
This commit is contained in:
jygaulier
2023-12-14 17:20:53 +01:00
committed by GitHub
parent e97751be96
commit 8df3cf55b7
12 changed files with 210 additions and 66 deletions

View File

@@ -458,8 +458,10 @@ class set_export extends set_abstract
// remove stamp on this collection
$stamp_by_base = []; // unset: no stamp ; false: stamp not "unstampable" ; true: stamp "unstampable"
$colls_manageable = array_keys($this->getAclForUser($user)->get_granted_base([ACL::COLL_MANAGE]) ?? []);
$dbox_manageable = array_keys($this->getAclForUser($user)->get_granted_sbas([ACL::BAS_MANAGE]) ?? []);
$colls_manageable = array_keys($this->getAclForUser($user)->get_granted_base([ACL::COLL_MANAGE]) ?? []);
$colls_editable = array_keys($this->getAclForUser($user)->get_granted_base([ACL::CANMODIFRECORD]) ?? []);
$colls_imgtoolsable = array_keys($this->getAclForUser($user)->get_granted_base([ACL::IMGTOOLS]) ?? []);
$dbox_manageable = array_keys($this->getAclForUser($user)->get_granted_sbas([ACL::BAS_MANAGE]) ?? []);
/** @var record_exportElement $download_element */
foreach ($this->elements as $download_element) {
@@ -511,6 +513,16 @@ class set_export extends set_abstract
$stamp_by_base[$bid] = self::NO_STAMP;
}
break;
case 'record_edit':
if (in_array($bid, $colls_editable)) {
$stamp_by_base[$bid] = self::NO_STAMP;
}
break;
case 'image_tools':
if (in_array($bid, $colls_imgtoolsable)) {
$stamp_by_base[$bid] = self::NO_STAMP;
}
break;
case 'manage_databox':
if (in_array($download_element->getDatabox()->get_sbas_id(), $dbox_manageable)) {
$stamp_by_base[$bid] = self::NO_STAMP;

View File

@@ -83,7 +83,8 @@ class set_exportftp extends set_export
->setFilename($filename)
->setFolder($properties['folder'])
->setRecordId($file['record_id'])
->setSubdef($subdef);
->setSubdef($subdef)
->setToStamp($file['to_stamp'] !== set_export::NO_STAMP);
$export->addElement($element);
$this->app['orm.em']->persist($element);