use wcf\http\Helper;
use wcf\system\cache\runtime\UserProfileRuntimeCache;
use wcf\system\exception\PermissionDeniedException;
-use wcf\system\file\processor\UserAvatarFileProcessor;
use wcf\system\form\builder\data\processor\CustomFormDataProcessor;
use wcf\system\form\builder\field\dependency\ValueFormFieldDependency;
use wcf\system\form\builder\field\FileProcessorFormField;
$user = UserProfileHandler::getInstance()->getUserProfile();
}
- if (!UserAvatarFileProcessor::canEditAvatar($user)) {
+ if (!$user->canEditAvatar()) {
throw new PermissionDeniedException();
}
&& $this->trophyPoints
&& ($this->isAccessible('canViewTrophies') || $this->userID == WCF::getSession()->userID);
}
+
+ /**
+ * @since 6.2
+ */
+ public function canEditAvatar(): bool
+ {
+ if (WCF::getSession()->getPermission('admin.user.canEditUser')) {
+ return true;
+ }
+
+ if ($this->userID !== WCF::getUser()->userID) {
+ return false;
+ }
+
+ if ($this->disableAvatar) {
+ return false;
+ }
+
+ return WCF::getSession()->getPermission('user.profile.avatar.canUploadAvatar');
+ }
}
return FileProcessorPreflightResult::InvalidContext;
}
- if (!UserAvatarFileProcessor::canEditAvatar($user)) {
+ if (!$user->canEditAvatar()) {
return FileProcessorPreflightResult::InsufficientPermissions;
}
) !== null;
}
- return UserAvatarFileProcessor::canEditAvatar($user);
+ return $user->canEditAvatar();
}
#[\Override]
return UserProfileRuntimeCache::getInstance()->getObject($userID);
}
-
- public static function canEditAvatar(UserProfile $user): bool
- {
- if (WCF::getSession()->getPermission('admin.user.canEditUser')) {
- return true;
- }
-
- if ($user->userID !== WCF::getUser()->userID) {
- return false;
- }
-
- if (WCF::getUser()->disableAvatar) {
- return false;
- }
-
- return WCF::getSession()->getPermission('user.profile.avatar.canUploadAvatar');
- }
}