Show More
@@ -1,156 +1,156 b'' | |||||
1 | ## snippet for displaying default permission box |
|
1 | ## snippet for displaying default permission box | |
2 | ## usage: |
|
2 | ## usage: | |
3 | ## <%namespace name="dpb" file="/base/default_perms_box.mako"/> |
|
3 | ## <%namespace name="dpb" file="/base/default_perms_box.mako"/> | |
4 | ## ${dpb.default_perms_box(<url_to_form>)} |
|
4 | ## ${dpb.default_perms_box(<url_to_form>)} | |
5 | ## ${dpb.default_perms_radios()} |
|
5 | ## ${dpb.default_perms_radios()} | |
6 |
|
6 | |||
7 | <%def name="default_perms_radios(global_permissions_template = False, suffix='', **kwargs)"> |
|
7 | <%def name="default_perms_radios(global_permissions_template = False, suffix='', **kwargs)"> | |
8 | <div class="main-content-full-width"> |
|
8 | <div class="main-content-full-width"> | |
9 | <div class="panel panel-default"> |
|
9 | <div class="panel panel-default"> | |
10 |
|
10 | |||
11 | ## displayed according to checkbox selection |
|
11 | ## displayed according to checkbox selection | |
12 | <div class="panel-heading"> |
|
12 | <div class="panel-heading"> | |
13 | %if not global_permissions_template: |
|
13 | %if not global_permissions_template: | |
14 | <h3 class="inherit_overlay_default panel-title">${_('Inherited Permissions')}</h3> |
|
14 | <h3 class="inherit_overlay_default panel-title">${_('Inherited Permissions')}</h3> | |
15 | <h3 class="inherit_overlay panel-title">${_('Custom Permissions')}</h3> |
|
15 | <h3 class="inherit_overlay panel-title">${_('Custom Permissions')}</h3> | |
16 | %else: |
|
16 | %else: | |
17 | <h3 class="panel-title">${_('Default Global Permissions')}</h3> |
|
17 | <h3 class="panel-title">${_('Default Global Permissions')}</h3> | |
18 | %endif |
|
18 | %endif | |
19 | </div> |
|
19 | </div> | |
20 |
|
20 | |||
21 | <div class="panel-body"> |
|
21 | <div class="panel-body"> | |
22 | %if global_permissions_template: |
|
22 | %if global_permissions_template: | |
23 | <p>${_('The following options configure the default permissions each user or group will inherit. You can override these permissions for each individual user or user group using individual permissions settings.')}</p> |
|
23 | <p>${_('The following options configure the default permissions each user or group will inherit. You can override these permissions for each individual user or user group using individual permissions settings.')}</p> | |
24 | %endif |
|
24 | %endif | |
25 | <div class="field"> |
|
25 | <div class="field"> | |
26 | <div class="label"> |
|
26 | <div class="label"> | |
27 | <label for="default_repo_create${suffix}">${_('Repository Creation')}:</label> |
|
27 | <label for="default_repo_create${suffix}">${_('Repository Creation')}:</label> | |
28 | </div> |
|
28 | </div> | |
29 | <div class="radios"> |
|
29 | <div class="radios"> | |
30 | ${h.radio('default_repo_create' + suffix, c.repo_create_choices[1][0], label=c.repo_create_choices[1][1], **kwargs)} |
|
30 | ${h.radio('default_repo_create' + suffix, c.repo_create_choices[1][0], label=c.repo_create_choices[1][1], **kwargs)} | |
31 | ${h.radio('default_repo_create' + suffix, c.repo_create_choices[0][0], label=c.repo_create_choices[0][1], **kwargs)} |
|
31 | ${h.radio('default_repo_create' + suffix, c.repo_create_choices[0][0], label=c.repo_create_choices[0][1], **kwargs)} | |
32 | <span class="help-block">${_('Permission to create root level repositories. When disabled, users can still create repositories inside their own repository groups.')}</span> |
|
32 | <span class="help-block">${_('Permission to create root level repositories. When disabled, users can still create repositories inside their own repository groups.')}</span> | |
33 | </div> |
|
33 | </div> | |
34 | </div> |
|
34 | </div> | |
35 | <div class="field"> |
|
35 | <div class="field"> | |
36 | <div class="label"> |
|
36 | <div class="label"> | |
37 | <label for="default_repo_create_on_write${suffix}">${_('Repository Creation With Group Write Access')}:</label> |
|
37 | <label for="default_repo_create_on_write${suffix}">${_('Repository Creation With Group Write Access')}:</label> | |
38 | </div> |
|
38 | </div> | |
39 | <div class="radios"> |
|
39 | <div class="radios"> | |
40 | ${h.radio('default_repo_create_on_write' + suffix, c.repo_create_on_write_choices[1][0], label=c.repo_create_on_write_choices[1][1], **kwargs)} |
|
40 | ${h.radio('default_repo_create_on_write' + suffix, c.repo_create_on_write_choices[1][0], label=c.repo_create_on_write_choices[1][1], **kwargs)} | |
41 | ${h.radio('default_repo_create_on_write' + suffix, c.repo_create_on_write_choices[0][0], label=c.repo_create_on_write_choices[0][1], **kwargs)} |
|
41 | ${h.radio('default_repo_create_on_write' + suffix, c.repo_create_on_write_choices[0][0], label=c.repo_create_on_write_choices[0][1], **kwargs)} | |
42 | <span class="help-block">${_('Write permission given on a repository group will allow creating repositories inside that group.')}</span> |
|
42 | <span class="help-block">${_('Write permission given on a repository group will allow creating repositories inside that group.')}</span> | |
43 | </div> |
|
43 | </div> | |
44 | </div> |
|
44 | </div> | |
45 | <div class="field"> |
|
45 | <div class="field"> | |
46 | <div class="label"> |
|
46 | <div class="label"> | |
47 | <label for="default_fork_create${suffix}">${_('Repository Forking')}:</label> |
|
47 | <label for="default_fork_create${suffix}">${_('Repository Forking')}:</label> | |
48 | </div> |
|
48 | </div> | |
49 | <div class="radios"> |
|
49 | <div class="radios"> | |
50 | ${h.radio('default_fork_create' + suffix, c.fork_choices[1][0], label=c.fork_choices[1][1], **kwargs)} |
|
50 | ${h.radio('default_fork_create' + suffix, c.fork_choices[1][0], label=c.fork_choices[1][1], **kwargs)} | |
51 | ${h.radio('default_fork_create' + suffix, c.fork_choices[0][0], label=c.fork_choices[0][1], **kwargs)} |
|
51 | ${h.radio('default_fork_create' + suffix, c.fork_choices[0][0], label=c.fork_choices[0][1], **kwargs)} | |
52 | <span class="help-block">${_('Permission to create root level repository forks. When disabled, users can still fork repositories inside their own repository groups.')}</span> |
|
52 | <span class="help-block">${_('Permission to create root level repository forks. When disabled, users can still fork repositories inside their own repository groups.')}</span> | |
53 | </div> |
|
53 | </div> | |
54 | </div> |
|
54 | </div> | |
55 | <div class="field"> |
|
55 | <div class="field"> | |
56 | <div class="label"> |
|
56 | <div class="label"> | |
57 | <label for="default_repo_group_create${suffix}">${_('Repository Group Creation')}:</label> |
|
57 | <label for="default_repo_group_create${suffix}">${_('Repository Group Creation')}:</label> | |
58 | </div> |
|
58 | </div> | |
59 | <div class="radios"> |
|
59 | <div class="radios"> | |
60 | ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[1][0], label=c.repo_group_create_choices[1][1], **kwargs)} |
|
60 | ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[1][0], label=c.repo_group_create_choices[1][1], **kwargs)} | |
61 | ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[0][0], label=c.repo_group_create_choices[0][1], **kwargs)} |
|
61 | ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[0][0], label=c.repo_group_create_choices[0][1], **kwargs)} | |
62 | <span class="help-block">${_('Permission to create root level repository groups. When disabled, repository group admins can still create repository subgroups within their repository groups.')}</span> |
|
62 | <span class="help-block">${_('Permission to create root level repository groups. When disabled, repository group admins can still create repository subgroups within their repository groups.')}</span> | |
63 | </div> |
|
63 | </div> | |
64 | </div> |
|
64 | </div> | |
65 | <div class="field"> |
|
65 | <div class="field"> | |
66 | <div class="label"> |
|
66 | <div class="label"> | |
67 | <label for="default_user_group_create${suffix}">${_('User Group Creation')}:</label> |
|
67 | <label for="default_user_group_create${suffix}">${_('User Group Creation')}:</label> | |
68 | </div> |
|
68 | </div> | |
69 | <div class="radios"> |
|
69 | <div class="radios"> | |
70 | ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[1][0], label=c.user_group_create_choices[1][1], **kwargs)} |
|
70 | ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[1][0], label=c.user_group_create_choices[1][1], **kwargs)} | |
71 | ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[0][0], label=c.user_group_create_choices[0][1], **kwargs)} |
|
71 | ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[0][0], label=c.user_group_create_choices[0][1], **kwargs)} | |
72 |
<span class="help-block">${_('Permission to allow user group creation. |
|
72 | <span class="help-block">${_('Permission to allow user group creation.')}</span> | |
73 | </div> |
|
73 | </div> | |
74 | </div> |
|
74 | </div> | |
75 |
|
75 | |||
76 | <div class="field"> |
|
76 | <div class="field"> | |
77 | <div class="label"> |
|
77 | <div class="label"> | |
78 | <label for="default_inherit_default_permissions${suffix}">${_('Inherit Permissions From The Default User')}:</label> |
|
78 | <label for="default_inherit_default_permissions${suffix}">${_('Inherit Permissions From The Default User')}:</label> | |
79 | </div> |
|
79 | </div> | |
80 | <div class="radios"> |
|
80 | <div class="radios"> | |
81 | ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[1][0], label=c.inherit_default_permission_choices[1][1], **kwargs)} |
|
81 | ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[1][0], label=c.inherit_default_permission_choices[1][1], **kwargs)} | |
82 | ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[0][0], label=c.inherit_default_permission_choices[0][1], **kwargs)} |
|
82 | ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[0][0], label=c.inherit_default_permission_choices[0][1], **kwargs)} | |
83 | <span class="help-block">${_('Inherit default permissions from the default user. Turn off this option to force explicit permissions for users, even if they are more restrictive than the default user permissions.')}</span> |
|
83 | <span class="help-block">${_('Inherit default permissions from the default user. Turn off this option to force explicit permissions for users, even if they are more restrictive than the default user permissions.')}</span> | |
84 | </div> |
|
84 | </div> | |
85 | </div> |
|
85 | </div> | |
86 |
|
86 | |||
87 | <div class="buttons"> |
|
87 | <div class="buttons"> | |
88 | ${h.submit('save',_('Save'),class_="btn")} |
|
88 | ${h.submit('save',_('Save'),class_="btn")} | |
89 | ${h.reset('reset',_('Reset'),class_="btn")} |
|
89 | ${h.reset('reset',_('Reset'),class_="btn")} | |
90 | </div> |
|
90 | </div> | |
91 | </div> |
|
91 | </div> | |
92 | </div> |
|
92 | </div> | |
93 | </div> |
|
93 | </div> | |
94 | </%def> |
|
94 | </%def> | |
95 |
|
95 | |||
96 | <%def name="default_perms_box(form_url)"> |
|
96 | <%def name="default_perms_box(form_url)"> | |
97 | ${h.secure_form(form_url, method='put')} |
|
97 | ${h.secure_form(form_url, method='put')} | |
98 | <div class="form"> |
|
98 | <div class="form"> | |
99 | <div class="fields"> |
|
99 | <div class="fields"> | |
100 | <div class="field panel panel-default panel-body"> |
|
100 | <div class="field panel panel-default panel-body"> | |
101 | <div class="label label-checkbox"> |
|
101 | <div class="label label-checkbox"> | |
102 | <label for="inherit_default_permissions">${_('Inherit from default settings')}:</label> |
|
102 | <label for="inherit_default_permissions">${_('Inherit from default settings')}:</label> | |
103 | </div> |
|
103 | </div> | |
104 | <div class="checkboxes"> |
|
104 | <div class="checkboxes"> | |
105 | ${h.checkbox('inherit_default_permissions',value=True)} |
|
105 | ${h.checkbox('inherit_default_permissions',value=True)} | |
106 | <span class="help-block"> |
|
106 | <span class="help-block"> | |
107 | ${h.literal(_('Select to inherit permissions from %s permissions settings, ' |
|
107 | ${h.literal(_('Select to inherit permissions from %s permissions settings, ' | |
108 | 'including default IP address whitelist and inheritance of \npermission by members of user groups.') |
|
108 | 'including default IP address whitelist and inheritance of \npermission by members of user groups.') | |
109 | % h.link_to('default user', url('admin_permissions_global')))} |
|
109 | % h.link_to('default user', url('admin_permissions_global')))} | |
110 | </span> |
|
110 | </span> | |
111 | </div> |
|
111 | </div> | |
112 | </div> |
|
112 | </div> | |
113 |
|
113 | |||
114 | ## INHERITED permissions == the user permissions in admin |
|
114 | ## INHERITED permissions == the user permissions in admin | |
115 | ## if inherit checkbox is set this is displayed in non-edit mode |
|
115 | ## if inherit checkbox is set this is displayed in non-edit mode | |
116 | <div class="inherit_overlay_default"> |
|
116 | <div class="inherit_overlay_default"> | |
117 | ${default_perms_radios(global_permissions_template = False, suffix='_inherited', disabled="disabled")} |
|
117 | ${default_perms_radios(global_permissions_template = False, suffix='_inherited', disabled="disabled")} | |
118 | </div> |
|
118 | </div> | |
119 |
|
119 | |||
120 | ## CUSTOM permissions |
|
120 | ## CUSTOM permissions | |
121 | <div class="inherit_overlay"> |
|
121 | <div class="inherit_overlay"> | |
122 | ${default_perms_radios(global_permissions_template = False)} |
|
122 | ${default_perms_radios(global_permissions_template = False)} | |
123 | </div> |
|
123 | </div> | |
124 | </div> |
|
124 | </div> | |
125 | </div> |
|
125 | </div> | |
126 | ${h.end_form()} |
|
126 | ${h.end_form()} | |
127 |
|
127 | |||
128 |
|
128 | |||
129 | ## JS |
|
129 | ## JS | |
130 | <script> |
|
130 | <script> | |
131 | var show_custom_perms = function(inherit_default){ |
|
131 | var show_custom_perms = function(inherit_default){ | |
132 | if(inherit_default) { |
|
132 | if(inherit_default) { | |
133 | $('.inherit_overlay_default').show(); |
|
133 | $('.inherit_overlay_default').show(); | |
134 | $('.inherit_overlay').hide(); |
|
134 | $('.inherit_overlay').hide(); | |
135 | } |
|
135 | } | |
136 | else { |
|
136 | else { | |
137 | $('.inherit_overlay').show(); |
|
137 | $('.inherit_overlay').show(); | |
138 | $('.inherit_overlay_default').hide(); |
|
138 | $('.inherit_overlay_default').hide(); | |
139 | } |
|
139 | } | |
140 | }; |
|
140 | }; | |
141 | $(document).ready(function(e){ |
|
141 | $(document).ready(function(e){ | |
142 | var inherit_checkbox = $('#inherit_default_permissions'); |
|
142 | var inherit_checkbox = $('#inherit_default_permissions'); | |
143 | var defaults = inherit_checkbox.prop('checked'); |
|
143 | var defaults = inherit_checkbox.prop('checked'); | |
144 | show_custom_perms(defaults); |
|
144 | show_custom_perms(defaults); | |
145 | inherit_checkbox.on('change', function(){ |
|
145 | inherit_checkbox.on('change', function(){ | |
146 | if($(this).prop('checked')){ |
|
146 | if($(this).prop('checked')){ | |
147 | show_custom_perms(true); |
|
147 | show_custom_perms(true); | |
148 | } |
|
148 | } | |
149 | else{ |
|
149 | else{ | |
150 | show_custom_perms(false); |
|
150 | show_custom_perms(false); | |
151 | } |
|
151 | } | |
152 | }) |
|
152 | }) | |
153 | }) |
|
153 | }) | |
154 | </script> |
|
154 | </script> | |
155 |
|
155 | |||
156 | </%def> |
|
156 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now