AlabLan opened a new pull request, #516:
URL: https://github.com/apache/casbin-jcasbin/pull/516

   ## Background
   
   Issue: https://github.com/apache/casbin/issues/1621
   
   This PR ports the users/roles separation feature (implemented in Go PR 
#1652) to the Java version,
   ensuring API and implementation logic are synchronized across languages.
   
   ## Changes
   
   ### New APIs
   - `getUsers()` - Get all users in the current policy
   - `getNamedUsers(ptype)` - Get all users in the specified policy type
   
   **Algorithm** (consistent with Go):
   Users = (subjects from "p" + users from "g" column 0) - roles from "g" 
column 1
   
   
   ### Ported Utilities
   | Go | Java |
   |----|------|
   | `GetValuesForFieldInPolicyAllTypes` | 
`Model.getValuesForFieldInPolicyAllTypes()` |
   | `SetSubtract` | `Util.setSubtract()` |
   | `ArrayRemoveDuplicates` | `Util.arrayRemoveDuplicates()` (existing) |
   
   ### Dynamic Field Index
   `getNamedUsers` uses `model.getFieldIndex(ptype, "sub")` to dynamically 
locate the subject field,
   ensuring compatibility with non-standard model definitions (consistent with 
Go behavior).
   
   ## Files Changed
   
   - `Model.java` - Add 2 methods
   - `Util.java` - Add `setSubtract()`
   - `ManagementEnforcer.java` - Add 2 APIs
   - `SyncedEnforcer.java` - Add thread-safe wrappers
   
   ## Testing
   - ManagementAPIUnitTest passes
   - API synchronized with Go implementation
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to