65 $this->performer = $performer;
66 $this->permManager = $permManager;
67 $this->title = $title;
74 if ( !$this->performer->authorizeWrite(
'create', $this->title ) ) {
75 $this->result = (string)self::AS_NO_CREATE_PERMISSION;
76 return self::CONSTRAINT_FAILED;
83 if ( $this->permManager->getPermissionErrors(
88 $this->result = self::CONSTRAINT_FAILED;
89 return self::CONSTRAINT_FAILED;
92 $this->result = self::CONSTRAINT_PASSED;
93 return self::CONSTRAINT_PASSED;
99 if ( $this->result === self::CONSTRAINT_FAILED ) {
100 if ( !$this->performer->isRegistered() ) {
101 $statusValue->
setResult(
false, self::AS_READ_ONLY_PAGE_ANON );
103 $statusValue->fatal(
'readonlytext' );
104 $statusValue->value = self::AS_READ_ONLY_PAGE_LOGGED;
106 } elseif ( $this->result === (
string)self::AS_NO_CREATE_PERMISSION ) {
107 $statusValue->fatal(
'nocreatetext' );
108 $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.