ejucovy avatar ejucovy committed f7aa017

add user_manager component (unimplemented)

Comments (0)

Files changed (2)


 from .conf_writer import GitoliteConfWriter
 from .perm_policy import GitolitePermissionPolicy
+from .user_manager import GitoliteUserManager


+import pkg_resources
+from trac.admin import IAdminPanelProvider
+from trac.core import *
+from trac.config import Option, BoolOption
+from trac.util.translation import _
+from trac.web.chrome import ITemplateProvider
+from trac_gitolite import utils
+class GitoliteUserManager(Component):
+    implements(IAdminPanelProvider, ITemplateProvider)
+    gitolite_admin_reponame = Option('trac-gitolite', 'admin_reponame',
+                                     default="gitolite-admin")
+    def get_users(self):
+        repo = self.env.get_repository(reponame=self.gitolite_admin_reponame)
+        node = repo.get_node("keydir")
+        assert node.isdir, "Node %s at /keydir/ is not a directory" % node
+        for child in node.get_entries():
+            name = child.get_name()
+            assert name.endswith(".pub"), "Node %s" % name
+            yield name[:-4]
+    ## IAdminPanelProvider methods
+    def get_admin_panels(self, req):
+        if 'VERSIONCONTROL_ADMIN' in req.perm:
+            yield ('versioncontrol', _('Version Control'), 'users', 
+                   _('Users'))
+    def render_admin_panel(self, req, category, page, path_info):
+        req.perm.require('VERSIONCONTROL_ADMIN')
+        pass
+    # ITemplateProvider methods
+    def get_htdocs_dirs(self):
+        return []
+    def get_templates_dirs(self):
+        return [pkg_resources.resource_filename('trac_gitolite', 'templates')]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.