Checks for expired users and delete's the ``User`` associated with
        it. Skips if the user ``is_staff``.

        :return: A list containing the deleted users.
769948
def delete_expired_users(self):
        
        deleted_users = []
        for user in self.filter(is_staff=False, is_active=False):
            if user.activation_key_expired():
                deleted_users.append(user)
                user.delete()
        return deleted_users
922426
def getusers(self, userlist):
        
        userobjs = [User(self, **rawuser) for rawuser in
                    self._getusers(names=userlist).get('users', [])]

        # Return users in same order they were passed in
        ret = []
        for u in userlist:
            for uobj in userobjs[:]:
                if uobj.email == u:
                    userobjs.remove(uobj)
                    ret.append(uobj)
                    break
        ret += userobjs
        return ret
881946
def staff_member_required(request):
    ""
    user = getattr(request, 'user', None)
    if user is None or not user.is_authenticated:
        return HttpResponse(status=401) # Unauthorized
    elif not user.is_staff:
        return HttpResponseForbidden()
1132556
def trash_for(self, user):
        
        return self.filter(
            recipient=user,
            recipient_deleted_at__isnull=False,
        ) | self.filter(
            sender=user,
            sender_deleted_at__isnull=False,
        )
411182
def DeleteUser(self, user_link, options=None):
        
        if options is None:
            options = {}

        path = base.GetPathFromLink(user_link)
        user_id = base.GetResourceIdOrFullNameFromLink(user_link)
        return self.DeleteResource(path,
                                   'users',
                                   user_id,
                                   None,
                                   options)
697838
def delete_user(self, uid=0, user_id=''):
        
        if not uid:
            users = self.get_users()
            users = list(filter(lambda x: x.user_id==str(user_id), users))
            if not users:
                return False
            uid = users[0].uid
        command = const.CMD_DELETE_USER
        command_string = pack('h', uid)
        cmd_response = self.__send_command(command, command_string)
        if not cmd_response.get('status'):
            raise ZKErrorResponse("Can't delete user")
        self.refresh_data()
        if uid == (self.next_uid - 1):
            self.next_uid = uid
661059
def deleted(self, deleted_since, filters=None, params=None):
        

        return self.tc_requests.deleted(
            self.api_type,
            self.api_sub_type,
            deleted_since,
            owner=self.owner,
            filters=filters,
            params=params,
        )
1277908
def remove_user(self, user):
        
        org_user = self._org_user_model.objects.get(user=user, organization=self)
        org_user.delete()

        # User removed signal
        user_removed.send(sender=self, user=user)
559948
def inspect_workers(self):
        
        workers = tuple(self.workers.values())
        expired = tuple(w for w in workers if not w.is_alive())

        for worker in expired:
            self.workers.pop(worker.pid)

        return ((w.pid, w.exitcode) for w in expired if w.exitcode != 0)
480099
def get_users_for_assigned_to():
    
    User = get_user_model()
    return User.objects.filter(is_active=True, is_staff=True)
216302
def delete_user(self, user):
        
        self.project_service.set_auth(self._token_project)
        self.project_service.delete_user(user)
611030
def show_user(self, user):
        
        res = self.post('loadUsers', {'userId': user})
        if isinstance(res, list) and len(res) > 0:
            res = res[0]
        return _fix_user(res)
1049685
def deactivate_user(self, user):
        
        res = super(SessionAwareSQLAlchemyUserDatastore, self).deactivate_user(
            user)
        if res:
            delete_user_sessions(user)
        return res
54069
def deleted_user_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/deleted_users/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
976801
def list_users(self):
        
        lines = output_lines(self.exec_psql('\\du'))
        return [line.split('|') for line in lines]
981310
def UsersDelete (self, user_id):
        
        if self.__SenseApiCall__('/users/{user_id}.json'.format(user_id = user_id), 'DELETE'):
            return True
        else:
            self.__error__ = "api call unsuccessful"
            return False
1225276
def remove(self, username=None):
        """"""
        self._user_list = [user for user in self._user_list if user.name != username]