Commits

mitar  committed 36aa07f

Added option of users for which menu entry is displayed.

  • Participants
  • Parent commits 6fc038f

Comments (0)

Files changed (1)

File navadd/navadd.py

         return ''
                 
     def get_navigation_items(self, req):
-	add = self.env.config.get('navadd', 'add_items', ''). \
-		replace(',', ' ').split()
-	
-	items = []
-	for a in add:
-	    title = self.env.config.get('navadd', '%s.title' % a)
-	    url = self.env.config.get('navadd', '%s.url' % a)
-	    perm = self.env.config.get('navadd', '%s.perm' % a)
-	    target = self.env.config.get('navadd', '%s.target' % a)
+        add = self.env.config.get('navadd', 'add_items', ''). \
+                replace(',', ' ').split()
+        
+        items = []
+        for a in add:
+            title = self.env.config.get('navadd', '%s.title' % a)
+            url = self.env.config.get('navadd', '%s.url' % a)
+            perm = self.env.config.get('navadd', '%s.perm' % a)
+            target = self.env.config.get('navadd', '%s.target' % a)
+            forusers = self.env.config.get('navadd', '%s.forusers' % a, '').replace(',', ' ').split()
 
-	    if perm and not req.perm.has_permission(perm):
-		continue
+            if perm and not req.perm.has_permission(perm):
+                continue
 
-	    if target not in ('mainnav', 'metanav'):
-		target = 'mainnav'
+            if forusers and req.authname not in forusers:
+                continue
 
-	    items.append((target, a, Markup('<a href="%s">%s</a>' % (url, title))))
-	
-	return items
+            if target not in ('mainnav', 'metanav'):
+                target = 'mainnav'
+
+            items.append((target, a, Markup('<a href="%s">%s</a>' % (url, title))))
+        
+        return items