Jasig/uPortal — pull request #261 by shawnconnolly (2014-03-08 00:12:11+00:00)
Title: UP-4006: Fixing the assumption that the first profile created is default.

https://issues.jasig.org/browse/UP-4006

Fixing the assumption that the first profile created is default. Any profile can now be created without the layout changing or being clobbered when switching.

There was an assumption that a profile named "default" was the first to be created. With respondr this is not a correct assumption. On login, if the default profile wasn't detected the layout for the user's current profile was set to 0(zero used to indicate a profile hasn't had a layout initialized). This resetting of the layout_id to 0 due to the default profile not being created was not correct. The layout that was created when respondr or defaultMobile is as valid as a default profile's layout.

Upon creation of a user profile, the layout_id for the new profile is set to 0. This is valid only if another profile has not been created and layout initialized. If there is another profile that has a saved layout(will always have a layout_id of non-zero), then the layout_id for the new profile should match the existing one to leverage it. The user profiles will share the same layout, when a layout has been created and switching profiles should not change the layout for the user.