Allow all users to view Special:UserRights
[lhc/web/wiklou.git] / includes / skins / SkinTemplate.php
index 2351ab8..e6763ca 100644 (file)
@@ -180,6 +180,7 @@ class SkinTemplate extends Skin {
                                        'text' => $ilLangName,
                                        'title' => $ilTitle,
                                        'class' => $class,
+                                       'link-class' => 'interlanguage-link-target',
                                        'lang' => $ilInterwikiCodeBCP47,
                                        'hreflang' => $ilInterwikiCodeBCP47,
                                ];
@@ -195,7 +196,6 @@ class SkinTemplate extends Skin {
        }
 
        protected function setupTemplateForOutput() {
-
                $request = $this->getRequest();
                $user = $this->getUser();
                $title = $this->getTitle();
@@ -256,7 +256,6 @@ class SkinTemplate extends Skin {
                if ( $oldContext ) {
                        $this->setContext( $oldContext );
                }
-
        }
 
        /**
@@ -1170,7 +1169,6 @@ class SkinTemplate extends Skin {
         * @return array
         */
        private function buildContentActionUrls( $content_navigation ) {
-
                // content_actions has been replaced with content_navigation for backwards
                // compatibility and also for skins that just want simple tabs content_actions
                // is now built by flattening the content_navigation arrays into one
@@ -1302,6 +1300,7 @@ class SkinTemplate extends Skin {
 
                        if ( $this->showEmailUser( $user ) ) {
                                $nav_urls['emailuser'] = [
+                                       'text' => $this->msg( 'tool-link-emailuser', $rootUser )->text(),
                                        'href' => self::makeSpecialUrlSubpage( 'Emailuser', $rootUser ),
                                        'tooltip-params' => [ $rootUser ],
                                ];
@@ -1310,11 +1309,14 @@ class SkinTemplate extends Skin {
                        if ( !$user->isAnon() ) {
                                $sur = new UserrightsPage;
                                $sur->setContext( $this->getContext() );
-                               if ( $sur->userCanExecute( $this->getUser() ) ) {
-                                       $nav_urls['userrights'] = [
-                                               'href' => self::makeSpecialUrlSubpage( 'Userrights', $rootUser )
-                                       ];
-                               }
+                               $canChange = $sur->userCanChangeRights( $this->getUser(), false );
+                               $nav_urls['userrights'] = [
+                                       'text' => $this->msg(
+                                               $canChange ? 'tool-link-userrights' : 'tool-link-userrights-readonly',
+                                               $this->getUser()->getName()
+                                       )->text(),
+                                       'href' => self::makeSpecialUrlSubpage( 'Userrights', $rootUser )
+                               ];
                        }
                }