Permissions
How access to AISquare content is controlled and how to handle permissions correctly.
Access in AISquare depends on three things together: a publication's visibility, the user's authentication, and the user's role or membership. Not all data is visible to all users, so your app should check access before fetching protected content.
Publication visibility
Every AI Studio (publication) carries a visibility setting.
| Type | Access |
|---|---|
PUBLIC | Anyone, no authentication required |
TEAM | Authenticated workspace members |
PRIVATE | Authenticated users with explicit access |
In short: public content is open, team content requires workspace membership, and private content requires explicit access.
Permission check
AISquare exposes an endpoint that validates whether a user can access a publication.
POST /aistudios/permission/{
"url": "ai-research-studio"
}It resolves the publication from the url, checks the user's membership and
roles, and may set a workspace context for subsequent requests.
How access is resolved
- Resolve the publication from the
url. - Check its visibility.
- Check authentication.
- Check membership or role.
- Grant or deny.
| Status | Meaning |
|---|---|
200 | Access granted |
401 | Authentication required |
404 | Publication not found or access denied |
404 can mean access denied
For non-public resources, a 404 may mean the user is not allowed to see the
publication rather than that it does not exist. Do not assume 404 always
means missing data.
Workspace context
When access is granted, AISquare may set a workspace context (a cookie) so later requests are scoped to the right workspace. Send it along on subsequent calls to keep behavior consistent.
Roles and membership
A user can hold different roles within a publication:
- Creator. The owner.
- Co-creator. An editor, reviewer, or other collaborator.
- Workspace member. A member of the workspace.
Roles determine whether a user can view content, edit or manage resources, and see metrics and analytics. See Studios for how creators and co-creators are managed.
Access patterns
Public content needs no check:
user -> request -> public data returnedRestricted content goes through authentication and a permission check first:
user -> authenticate -> permission check -> access grantedBest practices
- Check before you fetch. Call the permission endpoint before requesting protected data.
- Handle failures. On
401, prompt login; on404, show not found or restricted. See Errors. - Cache results. Avoid repeating the same check for the same user and publication.
- Do not assume access. Not every user can see every publication.
Common mistakes
- Skipping the check. Leads to surprise failures on later calls.
- Treating 404 as missing. It can mean access denied.
- Ignoring workspace context. Dropping the cookie causes inconsistent behavior across requests.
Putting it together
- The user selects a studio.
- Your backend checks permission.
- If allowed, fetch the data.
- If denied, handle the error.