Is there any way to tell what resource id is in sc...
# permit-saas
a
Is there any way to tell what resource id is in scope when resolving an invite_code generated using the elements? The API docs seem to center around inviting people to a workspace. My use case is to invite people to specific resources (ReBAC). Once they click the link, I need to navigate them to the appropriate resource. This promise could likely help enable
Copy code
Custom query parameters to your "Redirect To" URL
a
Hi @Abe Clark, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
a
Based on the available documentation, the current invite system doesn't directly expose resource-specific information in the invite_code (1) . The invite_code appears to be a unique identifier for validating the user's email, as shown in the approval example:
Copy code
await permit.api.users.approve(
    user_key="new_user",
    email="<mailto:new-user@example.com|new-user@example.com>",
    invite_code="ed32bc43e2194a80a5ef5e0339943b44"
)
You're correct that the custom query parameters feature mentioned as "Coming Soon" would help with your use case . The documentation states this will allow "Custom query parameters to your 'Redirect To' URL" , which would enable passing resource identifiers. For ReBAC-specific invitations, the User Management Element supports "Relationship-Based Access Control (ReBAC) Resource Roles" where users can manage permissions for individual resource instances (2) . However, the current invitation flow doesn't explicitly document how to retrieve the resource context from the invite_code. As a workaround until the custom query parameters feature is available, you might need to store the resource mapping server-side when generating the invitation, then look it up when processing the invite_code.
To learn more, see the sources I considered: [[1] Email Configuration and Templates](https://docs.permit.io/embeddable-uis/email-configuration-and-templates) [[2] User Management Element](https://docs.permit.io/embeddable-uis/element/user-management)
a
hmm ok -- hopefully not. That would render the elements useless (requiring we implement it via api directly)
a
Appreciate the feedback! Feel free to ask me again with additional guidance or context.
o
Hi Abe, I think you might be throwing away the baby with the bathwater. While I'd agree it would be ideal if the invites solved for display and not just auth, you can easily manage that experience separately on your side (e.g. by saving it in your db) while still getting a benefit from Elements
And of course you can include additional information in the invite via
redirect_to
, encoding the information on the URL
a
hmm not 100% clear how I'd use the elements and know where the invite_code should redirect them. Would that rely on me catching the webhook and saving it there? Or is there some frontend hook that I can connect with? I'd expect that if the element is scoped to a specific resource, that resource id would be available somewhere in the API, I just was unable to find it?
is there a way to specify the redirect_to in the element config? that would help solve the issue as well. I just don't see how that is done
o
You control the URL in your app the invite redirects to, that can indicate within your app what you want the user to see
a
gotcha -- but that is global to all invites right?
If I use this UI for multiple resources -- I'm unclear how to make sure I direct them to the correct instance
o
This should have been addressed by template variables - i.e. enabling you to place a {{variable}} in the redirect URI. But I see this is missing, my apologies. Let me check with @Shuvy Ankor on where this stands
a
Thanks! Seems like using User Management for ReBAC may be a bit bleeding edge. for example, webhooks seem opinionated toward new user invites vs. resource invites:
Copy code
{
    email: str,
    tenant_key: str,
    role: str,
    permission_level: str,
    type: ElementsWebhookType = "create_user"
}
All good -- I'm specifically evaluating this in terms of how it can support Rebac scaling for our app, so that's why I'm pushing on these Qs. Thanks!
@Shuvy Ankor lmk if you have any additional details on this. Important for us to roll this out.
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
s
Hi @Abe Clark, I am on vacation now and will take care of this when I return. (This weekend) I apologize for the delay. I understand the problem. I will open a ticket and resolve it as quickly as possible.
a
Got it, thanks Shuvy! Enjoy vacation.