@@ -188,42 +188,48 @@ def add_base_actions(self, request):
188
188
attrs = dict (href = safe_fa_url ('Project' , project .id , 'customer_requests' ))))
189
189
190
190
#Contract
191
- contract = HeaderSidebarAction ('contracts' ,
192
- content = u'Contracts' ,
193
- permission = 'edit' ,
194
- no_link = True )
195
- contract .append (Button (id = 'add' ,
196
- content = literal ('<i class="icon-plus-sign icon-white"></i>' ),
197
- _class = 'btn btn-success btn-mini' ,
198
- permission = 'edit' ,
199
- attrs = dict (href = safe_fa_url ('Project' , project .id , 'add_contract' ),
200
- title = "'Add contract'" )))
201
- self .actions .append (contract )
202
- self .actions .append (self .contracts )
203
- self .actions .append (SidebarAction ('list_all_contracts' ,
204
- content = u'List all...' ,
205
- permission = 'view' ,
206
- attrs = dict (href = safe_fa_url ('Project' , project .id , 'contracts' ))))
207
- self .actions .append (DividerSidebarAction ('div' ))
191
+ if request .has_permission ('view_contracts' , self .context .project ):
192
+ contract = HeaderSidebarAction ('contracts' ,
193
+ content = u'Contracts' ,
194
+ permission = 'view' ,
195
+ no_link = True )
196
+ if request .has_permission ('add_contracts' , self .context .project ):
197
+ contract .append (Button (id = 'add' ,
198
+ content = literal ('<i class="icon-plus-sign icon-white"></i>' ),
199
+ _class = 'btn btn-success btn-mini' ,
200
+ permission = 'view' ,
201
+ attrs = dict (href = safe_fa_url ('Project' , project .id , 'add_contract' ),
202
+ title = "'Add contract'" )))
203
+ self .actions .append (contract )
204
+ self .actions .append (self .contracts )
205
+ self .actions .append (SidebarAction ('list_all_contracts' ,
206
+ content = u'List all...' ,
207
+ permission = 'view' ,
208
+ attrs = dict (href = safe_fa_url ('Project' , project .id , 'contracts' ))))
209
+ self .actions .append (DividerSidebarAction ('div' ))
208
210
209
211
#Permissions
210
- permissions = HeaderSidebarAction ('permissions' ,
211
- content = u'Permissions' ,
212
- permission = 'edit' ,
213
- no_link = True )
214
- permissions .append (Button (id = 'view' ,
215
- content = literal ('<i class="icon-info-sign icon-white"></i>' ),
216
- _class = 'btn btn-info btn-mini' ,
217
- permission = 'edit' ,
218
- attrs = dict (href = safe_fa_url ('Project' , project .id , 'configuration' ),
219
- title = "'View groups'" )))
220
- permissions .append (Button (id = 'add' ,
221
- content = literal ('<i class="icon-plus-sign icon-white"></i>' ),
222
- _class = 'btn btn-success btn-mini' ,
223
- permission = 'new' ,
224
- attrs = dict (href = safe_fa_url ('Project' , project .id , 'add_group' ),
225
- title = "'Add group'" )))
226
- self .actions .append (permissions )
212
+ if request .has_permission ('view_groups' , self .context .project ):
213
+ permissions = HeaderSidebarAction ('permissions' ,
214
+ content = u'Permissions' ,
215
+ permission = 'view' ,
216
+ no_link = True )
217
+
218
+ permissions .append (Button (id = 'view' ,
219
+ content = literal ('<i class="icon-info-sign icon-white"></i>' ),
220
+ _class = 'btn btn-info btn-mini' ,
221
+ permission = 'view' ,
222
+ attrs = dict (href = safe_fa_url ('Project' , project .id , 'configuration' ),
223
+ title = "'View groups'" )))
224
+
225
+ if request .has_permission ('add_groups' , self .context .project ):
226
+ permissions .append (Button (id = 'add' ,
227
+ content = literal ('<i class="icon-plus-sign icon-white"></i>' ),
228
+ _class = 'btn btn-success btn-mini' ,
229
+ permission = 'view' ,
230
+ attrs = dict (href = safe_fa_url ('Project' , project .id , 'add_group' ),
231
+ title = "'Add group'" )))
232
+ self .actions .append (permissions )
227
233
228
234
def add_document_actions (self , only_trac = True ):
229
235
project = self .context .project
0 commit comments