def eval_shared_storage_scope()

in source/idea/idea-sdk/src/ideasdk/context/bootstrap_context.py [0:0]


    def eval_shared_storage_scope(self, shared_storage: Dict) -> bool:
        scope = Utils.get_value_as_list('scope', shared_storage, [])
        if Utils.is_empty(scope):
            return True

        context_vars = vars(self.vars)

        def eval_project() -> bool:
            if 'project' not in context_vars:
                return False
            projects = Utils.get_value_as_list('projects', shared_storage, [])
            return self.vars.project in projects

        def eval_module() -> bool:
            modules = Utils.get_value_as_list('modules', shared_storage, [])
            # empty list = allow all
            if Utils.is_empty(modules):
                return True
            return self.module_name in modules

        def eval_scheduler_queue_profile() -> bool:
            if 'queue_profile' not in context_vars:
                return False
            queue_profiles = Utils.get_value_as_list('queue_profiles', shared_storage, [])
            # empty list = allow all
            if Utils.is_empty(queue_profiles):
                return True
            return self.vars.queue_profile in queue_profiles

        def eval_internal_filesystem() -> bool:
            mount_dir = Utils.get_value_as_string('mount_dir', shared_storage, '')
            if mount_dir == '/internal':
                return True
            return False

        # Global filesystem attached to modules vs projects
        if 'cluster' in scope and 'project' not in context_vars:
            return True
        elif 'cluster' in scope and 'project' in context_vars:
            # Internal filesystem will always be attached
            return eval_project() or eval_internal_filesystem()

        if 'module' in scope and 'project' in scope:
            return eval_module() and eval_project()

        if 'project' in scope and 'scheduler:queue-profile' in scope:
            return eval_project() and eval_scheduler_queue_profile()

        if 'module' in scope:
            return eval_module()

        if 'project' in scope:
            return eval_project()

        if 'scheduler:queue-profile' in scope:
            return eval_scheduler_queue_profile()

        return False