// create standard default security domain and user role as necessary
// for portlet application permissions
SecurityDomainAccessManager domainAccessManager = (SecurityDomainAccessManager)scm.getComponent("org.apache.jetspeed.security.spi.SecurityDomainAccessManager");
if (domainAccessManager.getDomainByName(SecurityDomain.DEFAULT_NAME) == null)
{
SecurityDomainStorageManager domainStorageManager = (SecurityDomainStorageManager)scm.getComponent("org.apache.jetspeed.security.spi.SecurityDomainStorageManager");
SecurityDomainImpl defaultSecurityDomain = new SecurityDomainImpl();
defaultSecurityDomain.setName(SecurityDomain.DEFAULT_NAME);
domainStorageManager.addDomain(defaultSecurityDomain);
}
RoleManager roleManager = (RoleManager)scm.getComponent("org.apache.jetspeed.security.RoleManager");
if (!roleManager.roleExists("user"))
{
roleManager.addRole("user");