Pratham Khodwe
08/08/2025, 7:16 AMAsk Inkeep
08/08/2025, 7:16 AMAsk Inkeep
08/08/2025, 7:16 AMGetUserPermissions function to retrieve all permissions for a user. (1) Here's how to use it:
user := enforcement.UserBuilder("<mailto:john@doe.com|john@doe.com>") .Build()
permissions, err := Permit.GetUserPermissions(user, "tenant1", "tenant2")
You can also use GetUserPermissionsWithOptions for more control:
user := enforcement.UserBuilder("<mailto:john@doe.com|john@doe.com>") .Build()
permissions, err := Permit.GetUserPermissionsWithOptions(user,
enforcement.WithTenants([]string{"tenant1", "tenant2"}) ,
enforcement.WithResources([]string{"resource1", "resource2"}) ,
enforcement.WithResourceTypes([]string{"document", "file"}) ,
enforcement.WithContext(map[string]interface{}{"key": "value"}) ,
)
The function returns a UserPermissions map containing:
• Tenant details
• Resource information (if specified)
• Permissions array listing allowed actions
• Roles array listing assigned roles
Each tenant's permissions are keyed by tenant ID in the returned map.Ask Inkeep
08/08/2025, 7:16 AMAsk Inkeep
08/08/2025, 7:17 AM