Fix MIGRATE-DEV and Content model when the user is null (e.g. in cron jobs) (#7337)

This commit is contained in:
Marc Farré 2024-12-12 11:01:13 +00:00 committed by GitHub
parent b36b2fbaa4
commit 6a57a8cad2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,8 @@ Version 1.17 (Unreleased)
### Behaviour change
- Forms in modal box no longer have focus automatically on the first field. [The `autofocus` attribute](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/autofocus) is now required on the field. More info: [#7136](https://github.com/humhub/humhub/issues/7136)
- The new global "Manage Content" Group Permission allows viewing and editing all content event if the user has no permission to "Manage Users" or "Manage Spaces"
- The new "Manage All Content" Group Permission allows managing all content (view, edit, move, archive, pin, etc.) even if the user is not a super administrator. It is disabled by default. It can be enabled via the configuration file, using the `\humhub\modules\admin\Module::$enableManageAllContentPermission` option.
- Users allowed to "Manage Users" can no longer move all content: they need to be allowed to "Manage All Content".
### New
- CSS variables: `--hh-fixed-header-height` and `--hh-fixed-footer-height` (see [#7131](https://github.com/humhub/humhub/issues/7131)): these variables should be added to custom themes in the `variables.less` file to overwrite the fixed header (e.g. the top menu + margins) and footer heights with the ones of the custom theme.
@ -17,7 +18,7 @@ Version 1.17 (Unreleased)
### Deprecated
- `\humhub\modules\ui\menu\MenuEntry::isActiveState()` use `\humhub\helpers\ControllerHelper::isActivePath()` instead
- `\humhub\modules\content\Module::$adminCanViewAllContent` and `\humhub\modules\content\Module::adminCanEditAllContent` use `\humhub\modules\admin\Module::$enableGlobalManageContentPermission` instead which enables the "Manage All Content" Group Permission
- `\humhub\modules\content\Module::$adminCanViewAllContent` and `\humhub\modules\content\Module::adminCanEditAllContent` use `\humhub\modules\admin\Module::$enableManageAllContentPermission` instead which enables the "Manage All Content" Group Permission
- `\humhub\modules\user\models\User::canViewAllContent()` use `\humhub\modules\user\models\User::canManageAllContent()` instead
### Removed

View File

@ -743,7 +743,7 @@ class Content extends ActiveRecord implements Movable, ContentOwner, Archiveable
return
$this->getModel()->isOwner()
|| Yii::$app->user->identity->canManageAllContent()
|| Yii::$app->user->identity?->canManageAllContent()
|| $container->can(ManageContent::class);
}
@ -920,7 +920,7 @@ class Content extends ActiveRecord implements Movable, ContentOwner, Archiveable
return true;
}
if ($user->canManageAllContent()) {
if ($user?->canManageAllContent()) {
return true;
}