##// END OF EJS Templates
auth-plugins: updated UI for authentication plugins, and allow unsorted (in order of registration) display of plugins.
marcink -
r3233:4c12f36b default
parent child Browse files
Show More
@@ -19,6 +19,7 b''
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import logging
21 import logging
22 import collections
22
23
23 from pyramid.exceptions import ConfigurationError
24 from pyramid.exceptions import ConfigurationError
24
25
@@ -55,7 +56,7 b' class AuthnRootResource(AuthnResourceBas'
55 """
56 """
56
57
57 def __init__(self):
58 def __init__(self):
58 self._store = {}
59 self._store = collections.OrderedDict()
59 self._resource_name_map = {}
60 self._resource_name_map = {}
60 self.display_name = _('Global')
61 self.display_name = _('Global')
61
62
@@ -97,13 +98,17 b' class AuthnRootResource(AuthnResourceBas'
97 active = [item for item in self]
98 active = [item for item in self]
98 return sorted(active, key=sort_key)
99 return sorted(active, key=sort_key)
99
100
100 def get_nav_list(self):
101 def get_nav_list(self, sort=True):
101 """
102 """
102 Returns a sorted list of resources for displaying the navigation.
103 Returns a sorted list of resources for displaying the navigation.
103 """
104 """
104 list = self.get_sorted_list()
105 if sort:
105 list.insert(0, self)
106 nav_list = self.get_sorted_list()
106 return list
107 else:
108 nav_list = [item for item in self]
109
110 nav_list.insert(0, self)
111 return nav_list
107
112
108 def add_authn_resource(self, config, plugin_id, resource):
113 def add_authn_resource(self, config, plugin_id, resource):
109 """
114 """
@@ -29,7 +29,7 b''
29
29
30 <div class="sidebar">
30 <div class="sidebar">
31 <ul class="nav nav-pills nav-stacked">
31 <ul class="nav nav-pills nav-stacked">
32 % for item in resource.get_root().get_nav_list():
32 % for item in resource.get_root().get_nav_list(sort=False):
33 <li ${'class=active' if item == resource else ''}>
33 <li ${'class=active' if item == resource else ''}>
34 <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
34 <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
35 </li>
35 </li>
@@ -39,48 +39,54 b''
39
39
40 <div class="main-content-full-width">
40 <div class="main-content-full-width">
41 ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)}
41 ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)}
42 <div class="form">
43
44 <div class="panel panel-default">
42 <div class="panel panel-default">
45
43
46 <div class="panel-heading">
44 <div class="panel-heading">
47 <h3 class="panel-title">${_("Enabled and Available Plugins")}</h3>
45 <h3 class="panel-title">${_("Enabled and Available Plugins")}</h3>
48 </div>
46 </div>
49
47
50 <div class="fields panel-body">
48 <div class="panel-body">
51
49
52 <div class="field">
50
53 <div class="label">${_("Enabled Plugins")}</div>
51 <div class="label">${_("Ordered Enabled Plugins")}</div>
54 <div class="textarea text-area editor">
52 <div class="textarea text-area editor">
55 ${h.textarea('auth_plugins',cols=23,rows=5,class_="medium")}
53 ${h.textarea('auth_plugins',cols=120,rows=20,class_="medium")}
56 </div>
54 </div>
57 <p class="help-block pre-formatting">${_('List of plugins, separated by commas.'
55 <div class="field">
56 <p class="help-block pre-formatting">${_('List of plugins, separated by commas.'
58 '\nThe order of the plugins is also the order in which '
57 '\nThe order of the plugins is also the order in which '
59 'RhodeCode Enterprise will try to authenticate a user.')}</p>
58 'RhodeCode Enterprise will try to authenticate a user.')}
60 </div>
59 </p>
60 </div>
61
61
62 <div class="field">
62 <table class="rctable">
63 <div class="label">${_('Available Built-in Plugins')}</div>
63 <th>${_('Activate')}</th>
64 <ul class="auth_plugins">
64 <th>${_('Plugin Name')}</th>
65 %for plugin in available_plugins:
65 <th>${_('Documentation')}</th>
66 <li>
66 <th>${_('Plugin ID')}</th>
67 <div class="auth_buttons">
67 %for plugin in available_plugins:
68 <span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${'btn-success' if plugin.get_id() in enabled_plugins else ''}">
68 <tr>
69 ${_('enabled') if plugin.get_id() in enabled_plugins else _('disabled')}
69 <td>
70 </span>
70 <span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${'btn-success' if plugin.get_id() in enabled_plugins else ''}">
71 ${plugin.get_display_name()} (${plugin.get_id()})
71 ${_('enabled') if plugin.get_id() in enabled_plugins else _('disabled')}
72 </div>
72 </span>
73 </li>
73 </td>
74 %endfor
74 <td>${plugin.get_display_name()}</td>
75 </ul>
75 <td>
76 </div>
76 % if plugin.docs():
77 <a href="${plugin.docs()}">docs</a>
78 % endif
79 </td>
80 <td>${plugin.get_id()}</td>
81 </tr>
82 %endfor
83 </table>
77
84
78 <div class="buttons">
85 <div class="buttons">
79 ${h.submit('save',_('Save'),class_="btn")}
86 ${h.submit('save',_('Save'),class_="btn")}
80 </div>
87 </div>
81 </div>
88 </div>
82 </div>
89 </div>
83 </div>
84 ${h.end_form()}
90 ${h.end_form()}
85 </div>
91 </div>
86 </div>
92 </div>
@@ -263,7 +263,7 b''
263 // Alternative logo from static folder
263 // Alternative logo from static folder
264 $('.sign-in-image').attr("src", "/_static/rhodecode/images/RhodeCode_Logo_Black.png");
264 $('.sign-in-image').attr("src", "/_static/rhodecode/images/RhodeCode_Logo_Black.png");
265
265
266 // set width/height
266 // option to set width/height, adjust if required to make your image look good.
267 $('.sign-in-image').css({"width": "300px", "height": "345px"});
267 $('.sign-in-image').css({"width": "300px", "height": "345px"});
268
268
269 // 2) Header logo on top bar
269 // 2) Header logo on top bar
General Comments 0
You need to be logged in to leave comments. Login now