Skip to content

Commit

Permalink
fix: modify remove_filtered_policy method to support filtering of emp…
Browse files Browse the repository at this point in the history
…ty strings (#12)

* Modify remove_filtered_policy method to support filtering of empty strings

* Update adapter.py

fix format

* fix adapter.py black format
  • Loading branch information
sanguinedab authored Oct 26, 2024
1 parent 38221de commit 37e0561
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion casbin_pymongo_adapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ def remove_filtered_policy(self, sec, ptype, field_index, *field_values):
if not (1 <= field_index + len(field_values) <= 6):
return False
query = {
f"v{index + field_index}": value for index, value in enumerate(field_values)
f"v{index + field_index}": value
for index, value in enumerate(field_values)
if value != ""
}
query["ptype"] = ptype
results = self._collection.delete_many(query)
Expand Down

0 comments on commit 37e0561

Please sign in to comment.