def getAccessLevel(self, doc, user):
        if user is None:
            if doc.get('public', False):
                return AccessType.READ
            else:
                return AccessType.NONE
        elif user.get('admin', False):
            return AccessType.ADMIN
        else:
            access = doc.get('access', {})
            level = AccessType.NONE

            if doc['_id'] in user.get('groups', []):
                level = AccessType.READ
            elif doc['_id'] in [i['groupId'] for i in
                                user.get('groupInvites', [])]:
                return AccessType.READ

            for userAccess in access.get('users', []):
                if userAccess['id'] == user['_id']:
                    level = max(level, userAccess['level'])
                    if level == AccessType.ADMIN:
                        return level

            return level
Returns databook from XLS stream.
dataset/ETHPy150Open girder/girder/girder/models/group.py/Group.getAccessLevel--crossover with--dataset/ETHPy150Open kennethreitz/tablib/tablib/formats/_xlsx.py/import_book