@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function set_assignee($assignee) : bool |
| 248 | 248 | { |
| 249 | - if ( is_a($assignee, midcom_core_user::class) |
|
| 249 | + if (is_a($assignee, midcom_core_user::class) |
|
| 250 | 250 | || is_a($assignee, midcom_core_group::class)) { |
| 251 | 251 | $this->assignee = $assignee->id; |
| 252 | 252 | } elseif (is_string($assignee)) { |
@@ -305,12 +305,12 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - if ( !$this->is_magic_assignee() |
|
| 308 | + if (!$this->is_magic_assignee() |
|
| 309 | 309 | && !$this->get_assignee()) { |
| 310 | 310 | debug_add("The assignee identifier '{$this->assignee}' is invalid.", MIDCOM_LOG_INFO); |
| 311 | 311 | return false; |
| 312 | 312 | } |
| 313 | - if ( $this->assignee == 'OWNER' |
|
| 313 | + if ($this->assignee == 'OWNER' |
|
| 314 | 314 | && $this->privilegename == 'midgard:owner') { |
| 315 | 315 | debug_add("Tried to assign midgard:owner to the OWNER magic assignee, this is invalid.", MIDCOM_LOG_INFO); |
| 316 | 316 | return false; |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | MIDCOM_LOG_INFO); |
| 323 | 323 | return false; |
| 324 | 324 | } |
| 325 | - if ( !$object->can_do('midgard:update') |
|
| 325 | + if (!$object->can_do('midgard:update') |
|
| 326 | 326 | || !$object->can_do('midgard:privileges')) { |
| 327 | 327 | debug_add("Insufficient privileges on the content object with the GUID '{$this->__guid}', midgard:update and midgard:privileges required.", |
| 328 | 328 | MIDCOM_LOG_INFO); |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | if ($parent !== null) { |
| 134 | 134 | // Attachments are a special case |
| 135 | 135 | if ($object instanceof midcom_db_attachment) { |
| 136 | - if ( !$parent->can_do('midgard:attachments') |
|
| 136 | + if (!$parent->can_do('midgard:attachments') |
|
| 137 | 137 | || !$parent->can_do('midgard:update')) { |
| 138 | 138 | debug_add("Failed to create attachment, update or attachments privilege on the parent " . get_class($parent) . " {$parent->guid} not granted for the current user.", |
| 139 | 139 | MIDCOM_LOG_ERROR); |
| 140 | 140 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
| 141 | 141 | return false; |
| 142 | 142 | } |
| 143 | - } elseif ( !$parent->can_do('midgard:create') |
|
| 143 | + } elseif (!$parent->can_do('midgard:create') |
|
| 144 | 144 | && !midcom::get()->auth->can_user_do('midgard:create', null, get_class($object))) { |
| 145 | 145 | debug_add("Failed to create object, create privilege on the parent " . get_class($parent) . " {$parent->guid} or the actual object class not granted for the current user.", |
| 146 | 146 | MIDCOM_LOG_ERROR); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // Default the owner to first group of current user |
| 266 | - if ( empty($object->metadata->owner) |
|
| 266 | + if (empty($object->metadata->owner) |
|
| 267 | 267 | && $first_group = midcom::get()->auth->user->get_first_group_guid()) { |
| 268 | 268 | $object->metadata->set('owner', $first_group); |
| 269 | 269 | } |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | */ |
| 721 | 721 | public static function get_by_guid(midcom_core_dbaobject $object, $guid) : bool |
| 722 | 722 | { |
| 723 | - if ( !midcom::get()->auth->admin |
|
| 723 | + if (!midcom::get()->auth->admin |
|
| 724 | 724 | && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $guid, get_class($object), midcom::get()->auth->acl->get_user_id())) { |
| 725 | 725 | debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$guid} not granted for the current user.", MIDCOM_LOG_ERROR); |
| 726 | 726 | return false; |