|
|
+ |
This page lists miscellaneous scripts that are not directly defined by the other categories listed in the scripting site. These scripts were taken straight from the [https://bugs.urbancode.com/secure/IssueNavigator.jspa?reset=true&&pid=10110&sorter/field=issuekey&sorter/order=ASC public JIRA site]. Please note that some scripts may be ''snippets'' and '''probably WILL need''' modification to work properly for your situation. Treat these as templates that you can modify from.
|
|
|
+ |
= Template for adding users to realms =
|
|
|
+ |
* ''Treat this mostly as a snippet for doing something more interesting with.''
|
|
|
+ |
<pre>import com.urbancode.anthill3.domain.project.*;
|
|
|
+ |
import com.urbancode.anthill3.domain.authentication.*;
|
|
|
+ |
import com.urbancode.anthill3.domain.security.*;
|
|
|
+ |
import com.urbancode.anthill3.domain.singleton.security.*;
|
|
|
+ |
buildRole = RoleFactory.getInstance().restoreForName("Build Master");
|
|
|
+ |
userRole = RoleFactory.getInstance().restoreForName("User");
|
|
|
+ |
// Look-up the LDAP realm here
|
|
|
+ |
// This is a lookup by name, so insert the name of your LDAP realm.
|
|
|
+ |
realm = AuthenticationRealmFactory.getInstance().restore("LDAP");
|
|
|
+ |
// Do this for each user:
|
|
|
+ |
User user1 = new User(true, realm);
|
|
|
+ |
user1.setName("JaneDoe");
|
|
|
+ |
user1.setPassword("Bogus");
|
|
|
+ |
user1.addRole(buildRole);
|