Model class representing the current user's session.
Session
View sourceimport {useSession} from '@airtable/blocks/ui';function Username() {const session = useSession();if (session.currentUser !== null) {return <span>The current user's name is {session.currentUser.name}</span>;} else {return <span>This extension is being viewed in a public share</span>;}}
Members
class Session extends AbstractModel<SessionData, WatchableSessionKey>
readonly currentUser | CollaboratorData | null The current user, or
| ||||||
readonly id | string The ID for this model. | ||||||
readonly isDeleted | boolean
In general, it's best to avoid keeping a reference to an object past the
current event loop, since it may be deleted and trying to access any data
of a deleted object (other than its ID) will throw. But if you keep a
reference, you can use | ||||||
checkPermissionsForCreateRecords | function () => PermissionCheckResult Checks whether the current user has permission to create any records in the current base. For more granular permission checks, see Table.checkPermissionsForCreateRecords. Returns
| ||||||
checkPermissionsForDeleteRecords | function () => PermissionCheckResult Checks whether the current user has permission to delete any records in the current base. For more granular permission checks, see Table.checkPermissionsForDeleteRecords. Returns
| ||||||
checkPermissionsForUpdateRecords | function () => PermissionCheckResult Checks whether the current user has permission to update any records in the current base. For more granular permission checks, see Table.checkPermissionsForUpdateRecords. Returns
| ||||||
hasPermissionToCreateRecords | function () => boolean An alias for | ||||||
hasPermissionToDeleteRecords | function () => boolean An alias for | ||||||
hasPermissionToUpdateRecords | function () => boolean An alias for | ||||||
toString | function () => string A string representation of the model for use in debugging. | ||||||
unwatch | function (keys: WatchableSessionKey | ReadonlyArray<WatchableSessionKey>, callback:
Unwatch keys watched with Should be called with the same arguments given to Returns the array of keys that were unwatched. | ||||||
watch | function (keys: WatchableSessionKey | ReadonlyArray<WatchableSessionKey>, callback:
Get notified of changes to the model. Every call to Returns the array of keys that were watched. |