Thank you, @Tani Frankel !

This is useful through years!

Just adding here the snippet to add role to a user:

ClassMethod AddRoleToUser(user = "CSPSystem", role = "DB_USER_Read") As %Status

{

// Change to the %SYS namespace.

new $NAMESPACE

set $NAMESPACE="%SYS"



set status=##class(Security.Users).Get(user, .MyUserProps)

set $p(MyUserProps("Roles"),",",*)=role

set status=##class(Security.Users).Modify(user,.MyUserProps)



// Announce success.

if $$$ISOK(status) {

write !, "Roles for the user "_user_" were successfully modified."

}

Quit status

}