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