예제 #1
0
def _validate_user_has_line(user_line):
    user_lines = user_line_dao.find_all_by_user_id(user_line.user_id)
    if len(user_lines) == 0:
        raise errors.missing_association('User',
                                         'Line',
                                         user_id=user_line.user_id,
                                         line_id=user_line.line_id)
예제 #2
0
def validate_associated(line_extension):
    line_extensions = _all_line_extensions(line_extension.line_id)
    if line_extension not in line_extensions:
        raise errors.missing_association('Line',
                                         'Extension',
                                         line_id=line_extension.line_id,
                                         extension_id=line_extension.extension_id)
예제 #3
0
    def validate(self, user, funckey):
        if funckey.destination.type != 'bsfilter':
            return

        if not (user.call_filter_recipients or user.call_filter_surrogates):
            raise errors.missing_association('User',
                                             'BSFilter',
                                             user_id=user.id)
예제 #4
0
    def validate(self, user, funckey):
        if funckey.destination.type != 'bsfilter':
            return

        member_ids = [filter_member.member_id
                      for filter_member in self.dao.find_all_by_member_id(user.id)]
        if not member_ids:
            raise errors.missing_association('User', 'BSFilter', user_id=user.id)
예제 #5
0
    def validate(self, user, funckey):
        if funckey.destination.type != 'bsfilter':
            return

        member_ids = [
            filter_member.member_id
            for filter_member in self.dao.find_all_by_member_id(user.id)
        ]
        if not member_ids:
            raise errors.missing_association('User',
                                             'BSFilter',
                                             user_id=user.id)
예제 #6
0
 def validate_user_has_endpoint(self, user):
     if not user.lines:
         raise errors.missing_association('User',
                                          'Line',
                                          user_uuid=user.uuid)
예제 #7
0
 def validate_user(self, line):
     user_lines = self.user_line_dao.find_all_by(line_id=line.id)
     if not user_lines:
         raise errors.missing_association('User', 'Line', line_id=line.id)
예제 #8
0
 def validate_extension(self, line):
     line_extensions = self.line_extension_dao.find_all_by(line_id=line.id)
     if not line_extensions:
         raise errors.missing_association('Line',
                                          'Extension',
                                          line_id=line.id)
예제 #9
0
 def validate_endpoint(self, line):
     if not line.is_associated():
         raise errors.missing_association('Line',
                                          'Endpoint',
                                          line_id=line.id)
예제 #10
0
 def validate_line_has_user(self, line):
     exists = user_line_db.check_line_has_users(line.id)
     if not exists:
         raise errors.missing_association('Line', 'User')
예제 #11
0
def validate_associated_to_user(line_extension):
    user_lines = user_line_dao.find_all_by_line_id(line_extension.line_id)
    if not user_lines:
        raise errors.missing_association('Line', 'User', line_id=line_extension.line_id)