4D Blog

Home Product Dynamically grant user permissions

Dynamically grant user permissions

August 7, 2020

Product

Following the ability to use your own end user management system and the SET USER ALIAS command, you might be wondering how you can manage end user permissions without creating multiple 4D user accounts. Keep reading because this feature release has the answer!

4D developers often need to manage end users with their own directory system (e.g., from an internal development to external with LDAP or SSO). One solution was to create as many 4D user accounts as rights, then switch from one to another.

4D v18 R4 makes things more intuitive by allowing you to set users’ rights with groups … dynamically.

The easiest way to do this is to create a default user account with no group memberships:

Then you can create a group for each right you want to manage.

blank

At runtime, you can still use the SET USER ALIAS command to set the user name so it will appear everywhere in the database.

Now with the new SET GROUP ACCESS command, you can also dynamically set the group membership.

Note that these two commands are not available on the server side.

Here’s a code sample executed on a remote client after custom user authentication: 

// Set my own user field as alias
SET USER ALIAS([MyUserTable]Name)

// Set user groups following rights
C_COLLECTION($userGroups)
$userGroups:=New collection
If([MyUserTable]4DWriteProAccess)
 $userGroups.push(”4D Write Pro”)
End if
If([MyUserTable]4DViewProAccess)
 $userGroups.push(“4D View Pro”)
End if
SET GROUP ACCESS($userGroups)

You can set the current user group access to none if you want:

SET GROUP ACCESS(New collection)

You can reset the current user group access to how it’s stored in the directory file:

SET GROUP ACCESS

The new Get group access command allows you to retrieve the current group membership:

SET GROUP ACCESS(New collection(“4D View Pro”;”4D Write Pro”))

$collection:=Get group access
// $collection contains ["4D View Pro","4D Write Pro"]

All given group access don’t affect the user / group directory.

Now it’s your turn to give it a try. Manage your users and groups dynamically … as you want!

Discuss

Tags Authentication, User and group, v18 R4, v19

Latest related posts

  • November 14, 2025

    Event Report in 4D Qodly Pro: See Every Interactions at a Glance

  • November 14, 2025

    4D Qodly Pro: Page Zoom Controls

  • November 13, 2025

    macOS Tahoe, Windows 11, which operating systems for 4D 20 and 21?

Avatar
Damien Fuzeau
- Product Owner - Damien Fuzeau joined the 4D Product team in February 2019. As a Product Owner, he is responsible for writing user stories and translating them into functional specifications. His role also involves ensuring that the delivered feature implementations meet customer needs. Damien holds a degree in Software Engineering from the University of Nantes. He spent over 23 years at his previous company, first as a developer (discovering 4D in 1997), and later as Engineering Manager and Software Architect. The company was an OEM partner of 4D and deployed enterprise software based on 4D for thousands of users across hundreds of servers. Damien is therefore well-versed in 4D development and deployment in multilingual environments.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy