Forms comes with a built-in user management system. The currently logged-in user can be accessed programmatically using the top-level current_user variable. If no user is logged in, current_user's guest
function will be true
.
username
This method is available to server-side scripts.
Returns the current logged-in user's username.
current_user.username // "johndoe"
group_names
This method is available to server-side scripts.
Returns an array of group names that the user belongs to. For more information on the groups system, see groups.
current_user.group_names // ["Staff Members", "All Users", "Management"]
guest()
Returns a boolean which indicates that the user is not signed in.
current_user.guest() // false
signed_in()
Returns a boolean indicating whether or not the user is signed in. This is the opposite of guest.
current_user.signed_in() // true
integrated_services
Returns an array of the integrations that the current user has set up. For more information on scripting with third-party integrations, see Integrations. This method is currently unavailable from server-side scripts, but will be added shortly. Integration status can be queried using the Integrations API.
current_user.integrated_services // ["salesforce"]