extractRequestParams(); if ( $params['user'] === null ) { $params['user'] = $this->getUser()->getName(); } if ( !$this->getUser()->isAllowed( 'oathauth-api-all' ) ) { $this->dieUsage( 'You do not have permission to check OATH status', 'permissiondenied' ); } $user = User::newFromName( $params['user'] ); if ( $user === false ) { $this->dieUsageMsg( [ 'noname', $params['user'] ] ); } $result = $this->getResult(); $data = [ 'enabled' => false, ]; if ( !$user->isAnon() ) { $oathUser = OATHAuthHooks::getOATHUserRepository() ->findByUser( $user ); $data['enabled'] = $oathUser && $oathUser->getKey() !== null; } $result->addValue( 'query', $this->getModuleName(), $data ); } public function getCacheMode( $params ) { return 'private'; } public function isInternal() { return true; } public function getAllowedParams() { return [ 'user' => [ ApiBase::PARAM_TYPE => 'user', ], ]; } protected function getExamplesMessages() { return [ 'action=query&meta=oath' => 'apihelp-query+oath-example-1', 'action=query&meta=oath&oathuser=Example' => 'apihelp-query+oath-example-2', ]; } }