439 |
439 |
440 Args: |
440 Args: |
441 django_args: the keyword args from django, only scope_path is used |
441 django_args: the keyword args from django, only scope_path is used |
442 """ |
442 """ |
443 |
443 |
|
444 self.checkIsUser(django_args) |
|
445 |
444 if not field_name in django_args: |
446 if not field_name in django_args: |
445 self.deny(django_args) |
447 self.deny(django_args) |
446 |
448 |
447 if self.user.link_id == django_args[field_name]: |
449 if self.user.link_id == django_args[field_name]: |
448 return |
450 return |
569 |
571 |
570 def checkCanMakeRequestToGroup(self, django_args, group_logic): |
572 def checkCanMakeRequestToGroup(self, django_args, group_logic): |
571 """Raises an alternate HTTP response if the specified group is not in an |
573 """Raises an alternate HTTP response if the specified group is not in an |
572 active status. |
574 active status. |
573 |
575 |
574 Note that status hasn't been implemented yet |
|
575 |
|
576 Args: |
576 Args: |
577 group_logic: Logic module for the type of group which the request is for |
577 group_logic: Logic module for the type of group which the request is for |
578 """ |
578 """ |
|
579 |
|
580 self.checkIsUser(django_args) |
579 |
581 |
580 group_entity = role_logic.getGroupEntityFromScopePath( |
582 group_entity = role_logic.getGroupEntityFromScopePath( |
581 group_logic.logic, django_args['scope_path']) |
583 group_logic.logic, django_args['scope_path']) |
582 |
584 |
583 if not group_entity: |
585 if not group_entity: |
584 raise out_of_band.Error(DEF_GROUP_NOT_FOUND_MSG, status=404) |
586 raise out_of_band.Error(DEF_GROUP_NOT_FOUND_MSG, status=404) |
585 |
587 |
586 if group_entity.status != 'active': |
588 if group_entity.status != 'active': |
587 # TODO tell the user that this group is not active |
589 # tell the user that this group is not active |
588 raise out_of_band.AccessViolation(message_fmt=DEF_NO_ACTIVE_GROUP_MSG) |
590 raise out_of_band.AccessViolation(message_fmt=DEF_NO_ACTIVE_GROUP_MSG) |
589 |
591 |
590 return |
592 return |
591 |
593 |
592 def checkCanCreateFromRequest(self, django_args, role_name): |
594 def checkCanCreateFromRequest(self, django_args, role_name): |
621 """Raises an alternate HTTP response if the specified request does not exist |
623 """Raises an alternate HTTP response if the specified request does not exist |
622 or if it's status is completed or denied. Also Raises an alternate HTTP response |
624 or if it's status is completed or denied. Also Raises an alternate HTTP response |
623 whenever the group in the request is not active. |
625 whenever the group in the request is not active. |
624 """ |
626 """ |
625 |
627 |
|
628 self.checkIsUser(django_args) |
|
629 |
626 fields = { |
630 fields = { |
627 'link_id': django_args['link_id'], |
631 'link_id': django_args['link_id'], |
628 'scope_path': django_args['scope_path'], |
632 'scope_path': django_args['scope_path'], |
629 'role': role_name, |
633 'role': role_name, |
630 } |
634 } |