Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1171856
D174.id.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
Sun, Sep 28, 4:59 PM
Size
1 KB
Mime Type
text/x-diff
Expires
Mon, Sep 29, 4:59 PM (11 h, 53 m)
Engine
blob
Format
Raw Data
Handle
759392
Attached To
D174: INP-1520 - Honor manually set owner of categories/category items created from CLI
D174.id.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