Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1098706
D174.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Aug 14, 4:46 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Fri, Aug 15, 4:46 AM (1 h, 23 m)
Engine
blob
Format
Raw Data
Handle
708513
Attached To
D174: INP-1520 - Honor manually set owner of categories/category items created from CLI
D174.diff
View Options
Index: branches/5.2.x/core/kernel/db/cat_event_handler.php
===================================================================
--- branches/5.2.x/core/kernel/db/cat_event_handler.php
+++ branches/5.2.x/core/kernel/db/cat_event_handler.php
@@ -2360,11 +2360,15 @@
$object = $event->getObject();
/* @var $object kCatDBItem */
- $is_admin = $this->Application->isAdminUser;
$owner_field = $this->getOwnerField($event->Prefix);
- if ( (!$object->IsTempTable() && !$is_admin) || ($is_admin && !$object->GetDBField($owner_field)) ) {
- // Front-end OR owner not specified -> set to currently logged-in user
+ // Don't allow creating records on behalf of another user.
+ if ( !$this->Application->isAdminUser && !defined('CRON') ) {
+ $object->SetDBField($owner_field, $object->GetOriginalField($owner_field));
+ }
+
+ // Auto-assign records to currently logged-in user.
+ if ( !$object->GetDBField($owner_field) ) {
$object->SetDBField($owner_field, $this->Application->RecallVar('user_id'));
}
Index: branches/5.2.x/core/units/categories/categories_event_handler.php
===================================================================
--- branches/5.2.x/core/units/categories/categories_event_handler.php
+++ branches/5.2.x/core/units/categories/categories_event_handler.php
@@ -1842,9 +1842,13 @@
}
}
- $is_admin = $this->Application->isAdminUser;
+ // Don't allow creating records on behalf of another user.
+ if ( !$this->Application->isAdminUser && !defined('CRON') ) {
+ $object->SetDBField('CreatedById', $object->GetOriginalField('CreatedById'));
+ }
- if ( (!$object->IsTempTable() && !$is_admin) || ($is_admin && !$object->GetDBField('CreatedById')) ) {
+ // Auto-assign records to currently logged-in user.
+ if ( !$object->GetDBField('CreatedById') ) {
$object->SetDBField('CreatedById', $this->Application->RecallVar('user_id'));
}
Event Timeline
Log In to Comment