+
    ,i  c                   s   ^ RI Ht ^ RIHt ^RIHtHtHtHtH	t	 ^RI
Ht ^RIHtHtHt ^RIHt ^RIHt ^RIHt ^R	IHt ]! R
R
R7       ! R R]4      4       t ! R R]4      t ! R R]],          4      t ! R R]]	,          4      tR# )i    )defaultdict)	dataclass)AnyRBACRuleRBACRuletypeRole	RoleAllowRoleTransition)DiffResultDescriptor)
DifferenceDifferenceResultWrapper)class_wrapper_factory)role_wrapper_factory)type_or_attr_wrapper_factory)RuleListT)ZfrozenZorderc                   s0   a  ] tR t^t o RtV 3R ltRtV tR# )ModifiedRBACRulez,Difference details for a modified RBAC rule.c                s>   < V ^8  d   Qh/ S[ ;R&   S[;R&   S[;R&   # )   ruleZadded_defaultZremoved_default)r   r   Zformat__classdict__   "=/usr/lib64/python3.14/site-packages/setools/diff/rbacrules.py__annotate__ZModifiedRBACRule.__annotate__   s,     
           N)__name__
__module____qualname____firstlineno____doc____annotate_func____static_attributes____classdictcell__r      @r   r   r      s      7  r   r   c                   s  a  ] tR t^t o RtV 3R lR ltV 3R lR lt]],          ! ]4      t	]],          ! ]4      t
]],          ! ]4      t]],          ! ]4      t]],          ! ]4      tRtRtV 3R lR ltV 3R	 lR
 ltV 3R ltRtV tR# )RBACRulesDifferencez<Determine the difference in RBAC rules between two policies.c                   < V ^8  d   QhRR/# r   returnNr   r   r   r   r    RBACRulesDifference.__annotate__!   s     b b$ br   c                s   V P                   P                  RV P                   RV P                   24       V P                  e   V P
                  f   V P                  4        V P                  V P                  V P                  \        P                  ,          \        4      V P                  V P
                  \        P                  ,          \        4      4      w  V n        V n        pR# )zAGenerate the difference in role allow rules between the policies.z'Generating role allow differences from  to N)loginfoleft_policyright_policy_left_rbac_rules_right_rbac_rules_create_rbac_rule_lists	_set_diff_expand_generatorr   ZallowRoleAllowWrapperadded_role_allowsremoved_role_allows)selfZ_   & r   diff_role_allowsZ$RBACRulesDifference.diff_role_allows!   s     	5d6F6F5GtDL]L]K^_	a   (D,B,B,J((*
 ?Cnn""4#8#89K9K#LN^_""4#9#9,:L:L#MO_`?b; 8!r   c                r$   r%   r   r   r   r   r   r'   1   s     2 2t 2r   c                s   V P                   P                  RV P                   RV P                   24       V P                  e   V P
                  f   V P                  4        V P                  V P                  V P                  \        P                  ,          \        4      V P                  V P
                  \        P                  ,          \        4      4      w  rp\        \        ,          ! 4       pV Fd  w  rV\        VP                  4      \        VP                  4      8w  g   K4  VP!                  \        VVP                  VP                  4      4       Kf  	  Wn        W n        W@n        R# )zFGenerate the difference in role_transition rules between the policies.z,Generating role_transition differences from r(   N)r)   r*   r+   r,   r-   r.   r/   r0   r1   r   Zrole_transitionRoleTransitionWrapperlistr   r   Zdefaultappendadded_role_transitionsremoved_role_transitionsmodified_role_transitions)r5   ZaddedZremovedZmatchedZmodifiedZ	left_ruleZ
right_rules   &      r   diff_role_transitionsZ)RBACRulesDifference.diff_role_transitions1   s7    	:4;K;K:L M##$&	'   (D,B,B,J((*
 #'..""4#8#89U9U#V#8:""4#9#9,:V:V#W#8:#; ()+%,!I $I$5$56:NzOaOa:bb 01;1C1C1:1B1B!D E	 &- ',#(/%)1&r   Nc                r$   r%   r   r   r   r   r   r'   `   s     > > >r   c                s`   \        \        4      V n        V P                  P	                  RV P
                   24       V P
                  P                  4        F/  pV P                  VP                  ,          P                  V4       K1  	  \        \        4      V n	        V P                  P	                  RV P                   24       V P                  P                  4        F/  pV P                  VP                  ,          P                  V4       K1  	  V P                  P	                  R4       R# )z$Create rule lists for both policies.zBuilding RBAC rule lists from z#Completed building RBAC rule lists.N)r    r9   r-   r)   debugr+   Z	rbacrulesZruletyper:   r.   r,   r5   r   r6   r   r/   Z+RBACRulesDifference._create_rbac_rule_lists`   s     !,D 178H8H7IJK$$..0D!!$--077= 1 "-T!278I8I7JKL%%//1D""4==188> 2 	<=r   c                r$   r%   r   r   r   r   r   r'   p   s     & &T &r   c                sl    V P                   P                  R4       V =V =V =V =V =RV n        RV n        R# )z%Reset diff results on policy changes.zResetting RBAC rule differencesN)	r)   r?   r3   r4   r;   r<   r=   r-   r.   r5      &r   _reset_diffZRBACRulesDifference._reset_diffp   sC    89"$')* !%!%r   c                s^   < V ^8  d   Qh/ S[ S[S[3,          ;R&   S[ S[S[3,          ;R&   # )r   r-   r.   )r   r   r   r   r   r   r   r'      s7     z |[89@{ |  k 9:A} r   )r-   r.   r3   r;   r=   r4   r<   )r   r   r   r   r   r7   r>   r   r   r3   r4   r   r;   r<   r   r=   r-   r.   r/   rC   r   r   r    r!   r"   r   r#   r#      s     Fb b 2 2@ -Y78HI.y9:JK 2.ABWX3NCDYZ 45E FG\ ] =A=A
> > & &g  r   r#   c                   sL   a  ] tR t^~t o RtR	tV 3R lR ltR tR tR t	Rt
V tR# )
r2   z.Wrap role allow rules to allow set operations.c                $   < V ^8  d   QhRS[ RR/# r   r   r&   N)r   r   r   r   r   ZRoleAllowWrapper.__annotate__   s      Y 4 r   c                s    Wn         \        VP                  4      V n        \        VP                  4      V n        \	        V4      V n        R # N)originr   sourcetargethashkeyr@      &&r   __init__ZRoleAllowWrapper.__init__   s2    *4;;7*4;;7:r   c                    V P                   # rF   rK   rA   rB   r   __hash__ZRoleAllowWrapper.__hash__       xxr   c                4    V P                   VP                   8  # rF   rO   r5   ZotherrL   r   __lt__ZRoleAllowWrapper.__lt__       xx%))##r   c                sv    V P                   VP                   8H  ;'       d    V P                  VP                  8H  # rF   rH   rI   rS   rL   r   __eq__ZRoleAllowWrapper.__eq__   s,     {{ell*JJt{{ell/JJr   )rK   rG   rH   rI   NrV   r   r   r   r   r   Z	__slots__rM   rP   rT   rW   r   r    r!   r"   r   r2   r2   ~   s-     8$I $K Kr   r2   c                   sL   a  ] tR t^t o RtR	tV 3R lR ltR tR tR t	Rt
V tR# )
r8   z3Wrap role_transition rules to allow set operations.c                rD   rE   )r   r   r   r   r   Z"RoleTransitionWrapper.__annotate__   s      ^  r   c                s    Wn         \        VP                  4      V n        \        VP                  4      V n        \        VP                  4      V n        \        V4      V n        R # rF   )	rG   r   rH   r   rI   r   tclassrJ   rK   r@   rL   r   rM   ZRoleTransitionWrapper.__init__   sB    *4;;724;;?+DKK8:r   c                rN   rF   rO   rA   rB   r   rP   ZRoleTransitionWrapper.__hash__   rQ   r   c                rR   rF   rO   rS   rL   r   rT   ZRoleTransitionWrapper.__lt__   rU   r   c                s    V P                   VP                   8H  ;'       d;    V P                  VP                  8H  ;'       d    V P                  VP                  8H  # rF   rH   rI   rY   rS   rL   r   rW   ZRoleTransitionWrapper.__eq__   sM     {{ell* ( (KK5<<'( (KK5<<'	(r   )rK   rG   rH   rI   rY   NrZ   rX   r!   r"   r   r8   r8      s+     =.I $( (r   r8   N)Zcollectionsr    Zdataclassesr   Z	policyrepr   r   r   r   r   Zdescriptorsr   Z
differencer   r	   r
   Zobjclassr   Zrolesr   Ztypesr   Ztypingr   r   r#   r2   r8   r   r   r   <module>r[      s~    $ ! R R - = = + ' /  $d#'  $^&* ^&BKwy) K0(GN3 (r   