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

}

Thanks, Enrico! Namespace, of course! I prefer usualy the simplicity of having one Database in one Namespace if possible.

Your great answer doesn't answer though my question. The situation is: I deploy a package, which contains:

persistent class(es), data(generated ok, but could be different), WebApp (aka CSP app). I deploy a Role also, which will be used by the WebApp. Role need the access to database... Here is my question, which database resource do I provide to the role as I don't know the namespace the package will be installed by a potential user?