Skip to content

fix: remove deprecated comment from RemovePolicy method#1662

Open
gszw90 wants to merge 1 commit intoapache:masterfrom
gszw90:master
Open

fix: remove deprecated comment from RemovePolicy method#1662
gszw90 wants to merge 1 commit intoapache:masterfrom
gszw90:master

Conversation

@gszw90
Copy link

@gszw90 gszw90 commented Jan 7, 2026

This PR fixes an incorrect deprecation comment in the RemovePolicy method.
The current comment states:

// RemovePolicy removes a policy rule from the model.
// Deprecated: Using AddPoliciesWithAffected instead.
func (model Model) RemovePolicy(sec string, ptype string, rule []string) (bool, error) {
	...
}

However, this is incorrect because:

  1. RemovePolicy is used to remove a single policy rule
  2. AddPoliciesWithAffected is used to add policy rules
  3. These functions have completely different purposes - one removes while the other adds

The deprecation comment has been removed as it was providing incorrect guidance to users of the API.
Note: This issue exists in both v2 and v3 versions of the library.

@CLAassistant
Copy link

CLAassistant commented Jan 7, 2026

CLA assistant check
All committers have signed the CLA.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR corrects an incorrect deprecation comment on the RemovePolicy method that was mistakenly suggesting users should use AddPoliciesWithAffected instead. The removal is appropriate since:

  • RemovePolicy removes a single policy rule
  • AddPoliciesWithAffected adds multiple policy rules
  • These methods serve opposite purposes (remove vs. add)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants