equal
deleted
inserted
replaced
115 super(View, self)._editPost(request, entity, fields) |
115 super(View, self)._editPost(request, entity, fields) |
116 |
116 |
117 @decorators.merge_params |
117 @decorators.merge_params |
118 @decorators.check_access |
118 @decorators.check_access |
119 def listRequests(self, request, access_type, |
119 def listRequests(self, request, access_type, |
120 page_name=None, params=None, **kwargs): |
120 page_name=None, params=None, **kwargs): |
121 """Gives an overview of all the requests for a specific group. |
121 """Gives an overview of all the requests for a specific group. |
122 |
122 |
123 Args: |
123 Args: |
124 request: the standard Django HTTP request object |
124 request: the standard Django HTTP request object |
125 access_type : the name of the access type which should be checked |
125 access_type : the name of the access type which should be checked |
138 |
138 |
139 role_names = params['role_views'].keys() |
139 role_names = params['role_views'].keys() |
140 |
140 |
141 # list all incoming requests |
141 # list all incoming requests |
142 filter = { |
142 filter = { |
143 'scope' : group_entity, |
143 'scope': group_entity, |
144 'role': role_names, |
144 'role': role_names, |
145 'state': 'new' |
145 'state': 'new' |
146 } |
146 } |
147 |
147 |
148 # create the list parameters |
148 # create the list parameters |
156 inc_req_content = list_helper.getListContent( |
156 inc_req_content = list_helper.getListContent( |
157 request, inc_req_params, filter, 0) |
157 request, inc_req_params, filter, 0) |
158 |
158 |
159 # list all outstanding invites |
159 # list all outstanding invites |
160 filter = { |
160 filter = { |
161 'scope' : group_entity, |
161 'scope': group_entity, |
162 'role': role_names, |
162 'role': role_names, |
163 'state': 'group_accepted' |
163 'state': 'group_accepted' |
164 } |
164 } |
165 |
165 |
166 # create the list parameters |
166 # create the list parameters |
174 out_inv_content = list_helper.getListContent( |
174 out_inv_content = list_helper.getListContent( |
175 request, out_inv_params, filter, 1) |
175 request, out_inv_params, filter, 1) |
176 |
176 |
177 # list all ignored requests |
177 # list all ignored requests |
178 filter = { |
178 filter = { |
179 'scope' : group_entity, |
179 'scope': group_entity, |
180 'role': role_names, |
180 'role': role_names, |
181 'state': 'ignored' |
181 'state': 'ignored' |
182 } |
182 } |
183 |
183 |
184 # create the list parameters |
184 # create the list parameters |
276 params = dicts.merge(params, self._params) |
276 params = dicts.merge(params, self._params) |
277 logic = params['logic'] |
277 logic = params['logic'] |
278 |
278 |
279 # set fields to match every active role this user has |
279 # set fields to match every active role this user has |
280 fields = {'user': user, |
280 fields = {'user': user, |
281 'state' : 'active'} |
281 'state': 'active'} |
282 |
282 |
283 # get the role views and start filling group_entities |
283 # get the role views and start filling group_entities |
284 role_views = self._params['role_views'] |
284 role_views = self._params['role_views'] |
285 role_descriptions = {} |
285 role_descriptions = {} |
286 |
286 |
310 # add this description to existing roles |
310 # add this description to existing roles |
311 existing_roles = existing_role_descriptions['roles'] |
311 existing_roles = existing_role_descriptions['roles'] |
312 existing_roles[role_name] = role |
312 existing_roles[role_name] = role |
313 else: |
313 else: |
314 # create a description of this role |
314 # create a description of this role |
315 role_description = {'roles' : {role_name: role}, |
315 role_description = {'roles': {role_name: role}, |
316 'group' : role.scope} |
316 'group': role.scope} |
317 |
317 |
318 # add the new entry to our dictionary |
318 # add the new entry to our dictionary |
319 role_descriptions[group_key_name] = role_description |
319 role_descriptions[group_key_name] = role_description |
320 |
320 |
321 # get the document view params to add the group's documents to the menu |
321 # get the document view params to add the group's documents to the menu |
353 menus.append(menu) |
353 menus.append(menu) |
354 |
354 |
355 return menus |
355 return menus |
356 |
356 |
357 def _getExtraMenuItems(self, role_description, params=None): |
357 def _getExtraMenuItems(self, role_description, params=None): |
358 """Used to implement group instance specific needs for the side menu |
358 """Used to implement group instance specific needs for the side menu. |
359 |
359 |
360 Args: |
360 Args: |
361 role_description : dict containing all the roles which is a dict of |
361 role_description : dict containing all the roles which is a dict of |
362 name and the role entity to which it belongs. Also |
362 name and the role entity to which it belongs. Also |
363 group contains the group entity to which these roles |
363 group contains the group entity to which these roles |