...
Panel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
Vinny Khosla asked on the JASIG-PORTAL list: How do i setup a user layout template? Could you please tell me what tables, columns and xml files are involved Do the new users automatically inherit the layout template? |
...
Source code snippets implementing the described behavior
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
boolean hasSavedLayout = userHasSavedLayout(portalUser.getUserId()); if (!hasSavedLayout) { TemplateUser templateUser = getTemplateUser(templateName); if (portalUser.getDefaultUserId() != templateUser.getUserId()) { //Update user data with new template user's data updateUser(portalUser.getUserId(), person, templateUser); } } |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
protected void updateUser(int userId, IPerson person, TemplateUser templateUser) throws Exception { // Remove my existing group memberships IGroupMember me = GroupService.getGroupMember(person.getEntityIdentifier()); Iterator myExistingGroups = me.getContainingGroups(); while (myExistingGroups.hasNext()) { IEntityGroup eg = (IEntityGroup)myExistingGroups.next(); ILockableEntityGroup leg = GroupService.findLockableGroup(eg.getKey(), me.getKey()); removePersonFromGroup(person, me, leg); } // Copy template user's groups memberships IGroupMember template = GroupService.getEntity(templateUser.getUserName(), Class.forName("org.jasig.portal.security.IPerson")); Iterator templateGroups = template.getContainingGroups(); while (templateGroups.hasNext()) { IEntityGroup eg = (IEntityGroup)templateGroups.next(); ILockableEntityGroup leg = GroupService.findLockableGroup(eg.getKey(), me.getKey()); addPersonToGroup(person, me, leg); } |