Subject: How to set all Roles for a server entry?
Looping through all the roles in the ACL and granting them to the server may be a kludgey way to patch the problem (although, depending on the design, it might not work anyway), but it doesn’t get at the issue here, which is that some of your dbs are incorrectly designed. (Not just poorly, but flat-out slap-on-the-wrist-and-send-you-to-your-room-with-no-dinner wrong.) And the bad design should be fixed.
AUTHORS: The server shouldn’t need to be in Authors fields at all, since those have no effect on Editor and above, and one assumes the server is at least an Editor.
READERS: In a correctly-designed db, all servers should already be referred to in some Readers field in any document which uses them. This ensures that not only can the server update Authors fields during a name change, but that the server can see the document so that it will actually replicate. How to fix? Depends on the individual form and how it uses Readers fields. Is it using $Readers? One or more Readers fields in the form? Computed or Editable? Roles or not? If Roles, which Role?
Yes, you wanted to avoid the need to go into the design of each db and look at Role names, but the right way to fix this is to do just that.
For example, a form with an Editable Readers field can have a computed Readers field added to it: @if(EditableReadersField = “”; “”; “LocalDomainServers”). (And I’m taking it as a given that you understand that once you fix the form, this will in no way affect any existing docs, only new ones, and you’ll need to run an agent to update existing docs to contain the correct data.)
If one assumes that granting the server every role in every db will indeed work, then something like
set db = …
set acl = db.acl
set serverentry = acl.getentry(…)
forall r in acl.roles
serverentry.enablerole(r)
end forall
acl.save
will certainly do that – if you can work out whether you want to work with an existing individual server entry or the localdomainservers group entry or create a new individual server entry.
But I wouldn’t do it that way.