@@ -240,6 +240,14 @@ def add_grouping_policies(self, rules):
240240 """
241241 return self .add_named_grouping_policies ("g" , rules )
242242
243+ def add_grouping_policies_ex (self , rules ):
244+ """add_grouping_policies_ex adds role inheritance rules to the current policy.
245+
246+ If the rule already exists, the rule will not be added.
247+ But unlike add_grouping_policies, other non-existent rules are added instead of returning false directly.
248+ """
249+ return self .add_named_grouping_policies_ex ("g" , rules )
250+
243251 def add_named_grouping_policy (self , ptype , * params ):
244252 """adds a named role inheritance rule to the current policy.
245253
@@ -275,6 +283,18 @@ def add_named_grouping_policies(self, ptype, rules):
275283
276284 return rules_added
277285
286+ def add_named_grouping_policies_ex (self , ptype , rules ):
287+ """add_named_grouping_policies_ex adds role inheritance rules to the current policy.
288+
289+ If the rule already exists, the rule will not be added.
290+ But unlike add_named_grouping_policies, other non-existent rules are added instead of returning false directly.
291+ """
292+ rules_added = self ._add_policies_ex ("g" , ptype , rules )
293+ if rules_added and self .auto_build_role_links :
294+ self .model .build_incremental_role_links (self .rm_map [ptype ], PolicyOp .Policy_add , "g" , ptype , rules )
295+
296+ return rules_added
297+
278298 def remove_grouping_policy (self , * params ):
279299 """removes a role inheritance rule from the current policy."""
280300 return self .remove_named_grouping_policy ("g" , * params )
0 commit comments