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