First, WIKI-Roles are assigned by the system -- either JSPWiki (internally) or externally by the web container.
Because WIKI-Groups are managed by JSPWiki, we have complete control of querying the database, adding and deleting WIKI-Groups , and testing for membership. That means that users who are added to WIKI-Groups receive the privileges immediately.
WIKI-Roles (container-managed ones, anyway) are treated differently by necessity. The set of WIKI-Roles that JSPWiki "knows" about is determined only when JSPWiki starts. Specifically, this happens when WebContainerAuthorizer's initialize() method parses web.xml.
Next, users are tested for membership in that set of "known" container roles only when they log in. This is done for performance reasons: it would be a huge drain on performance to query the set of known container roles every time we needed to do an authorization check (which could be done several dozen times PER page).
If you grant privileges in WIKI-ACLs, you don't need to specify whether it's a role or group; you can just specify names like Foo, Bar, All, or Authenticated. JSPWiki prioritizes Authorization in the following order:
This is also the order in which naming conflicts are resolved. If your container emits a role called "Anonymous," JSPWiki will ignore it because it conflicts with a built-in role by that name. This is done to prevent Role spoofing.If they don't really require an admin to create them, consider changing some of the roles into WIKI-Groups instead (and let the users manage them).
If you want to let users create the WIKI-Groups themselves -- AND need to share them with other apps -- you might instead want to implement your own GroupDatabase to interface with JNDI. Bear in mind, however, that GroupDatabases are expected to have read-write access to the back end (LDAP in your example). If you need to restrict who gets to create groups, of course, you can do this by modifying your WIKI-Security Policy.
So even though your (hypothetical) JNDIGroupDatabase would have full access to the branch of LDAP that stores your multi-app groups, you could still make sure that just the "Admin" group (or "Admin" container role) would be the only ones adding or editing WIKI-Groups.
Regards, Andrew