from typing import Any

from gen_epix.casedb.domain import command
from gen_epix.commondb.domain.service import BaseAbacService
from gen_epix.commondb.policies import (
    ReadSelfResultsOnlyPolicy as CommonReadSelfResultsOnlyPolicy,
)


class ReadSelfResultsOnlyPolicy(CommonReadSelfResultsOnlyPolicy):
    def __init__(
        self,
        abac_service: BaseAbacService,
        **kwargs: Any,
    ):
        super().__init__(
            abac_service,
            **kwargs,
        )
        self.id_attr_by_command_class.update(
            {
                command.UserAccessCasePolicyCrudCommand: "user_id",
                command.UserShareCasePolicyCrudCommand: "user_id",
            }
        )
