38 private User $performer;
41 private string $result;
56 $this->performer = $performer;
57 $this->permManager = $permManager;
58 $this->title = $title;
65 if ( !$this->performer->authorizeWrite(
'create', $this->title ) ) {
66 $this->result = (string)self::AS_NO_CREATE_PERMISSION;
67 return self::CONSTRAINT_FAILED;
74 if ( !$this->permManager->userCan(
79 $this->result = self::CONSTRAINT_FAILED;
80 return self::CONSTRAINT_FAILED;
83 $this->result = self::CONSTRAINT_PASSED;
84 return self::CONSTRAINT_PASSED;
90 if ( $this->result === self::CONSTRAINT_FAILED ) {
91 if ( !$this->performer->isRegistered() ) {
92 $statusValue->
setResult(
false, self::AS_READ_ONLY_PAGE_ANON );
94 $statusValue->fatal(
'readonlytext' );
95 $statusValue->value = self::AS_READ_ONLY_PAGE_LOGGED;
97 } elseif ( $this->result === (
string)self::AS_NO_CREATE_PERMISSION ) {
98 $statusValue->fatal(
'nocreatetext' );
99 $statusValue->value = self::AS_NO_CREATE_PERMISSION;
if(!defined('MW_SETUP_CALLBACK'))
Verify user permissions: Must have edit rights.
__construct(User $performer, PermissionManager $permManager, Title $title, bool $new)
getLegacyStatus()
Get the legacy status for failure (or success)
Generic operation result class Has warning/error list, boolean status and arbitrary value.
setResult( $ok, $value=null)
Change operation result.
Interface for all constraints that can prevent edits.