From: <ma...@rh...> - 2009-08-10 19:36:52
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [4841] [RHQ-2189] need to do some checks to avoid errors if a new LDAP user just logged on but didn't register yet</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>4841</dd> <dt>Author</dt> <dd>mazz</dd> <dt>Date</dt> <dd>2009-08-10 14:36:41 -0500 (Mon, 10 Aug 2009)</dd> </dl> <h3>Log Message</h3> <pre>[RHQ-2189] need to do some checks to avoid errors if a new LDAP user just logged on but didn't register yet</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiauthorizationGlobalPermissionsUIBeanjava">rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authorization/GlobalPermissionsUIBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverauthprefsSubjectPreferencesBasejava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverauthprefsSubjectPreferencesCachejava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesCache.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulesenterpriseguiportalwarsrcmainjavaorgrhqenterpriseguiauthorizationGlobalPermissionsUIBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authorization/GlobalPermissionsUIBean.java (4840 => 4841)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authorization/GlobalPermissionsUIBean.java 2009-08-10 18:28:34 UTC (rev 4840) +++ rhq/trunk/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/authorization/GlobalPermissionsUIBean.java 2009-08-10 19:36:41 UTC (rev 4841) </span><span class="lines">@@ -37,12 +37,15 @@ </span><span class="cx"> public GlobalPermissionsUIBean() { Subject user = EnterpriseFacesContextUtility.getSubject(); </span><span class="rem">- Set<Permission> globalPermissions = LookupUtil.getAuthorizationManager().getExplicitGlobalPermissions(user); </span><span class="cx"> </span><span class="rem">- security = globalPermissions.contains(Permission.MANAGE_SECURITY); - inventory = globalPermissions.contains(Permission.MANAGE_INVENTORY); - settings = globalPermissions.contains(Permission.MANAGE_SETTINGS); - isSuperuser = LookupUtil.getAuthorizationManager().isSystemSuperuser(user); </span><span class="add">+ // if a subject ID is 0, it probably means this is a new LDAP user that needs to be registered + if (user.getId() != 0) { + Set<Permission> globalPermissions = LookupUtil.getAuthorizationManager().getExplicitGlobalPermissions(user); + security = globalPermissions.contains(Permission.MANAGE_SECURITY); + inventory = globalPermissions.contains(Permission.MANAGE_INVENTORY); + settings = globalPermissions.contains(Permission.MANAGE_SETTINGS); + isSuperuser = LookupUtil.getAuthorizationManager().isSystemSuperuser(user); + } </span><span class="cx"> SystemManagerLocal systemManager = LookupUtil.getSystemManager(); isDebugMode = Boolean.valueOf(systemManager.getSystemConfiguration().getProperty(RHQConstants.EnableDebugMode)); </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverauthprefsSubjectPreferencesBasejava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java (4840 => 4841)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java 2009-08-10 18:28:34 UTC (rev 4840) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesBase.java 2009-08-10 19:36:41 UTC (rev 4841) </span><span class="lines">@@ -119,8 +119,12 @@ </span><span class="cx"> protected String getPreference(String key) throws IllegalArgumentException { PropertySimple prop = SubjectPreferencesCache.getInstance().getUserProperty(subjectId, key); </span><span class="rem">- if (prop == null) </span><span class="add">+ if (prop == null) { + if (this.subjectId == 0) { + return ""; // this is probably an LDAP user that needs to register first + } </span><span class="cx"> throw new IllegalArgumentException("preference '" + key + "' requested is not valid"); </span><span class="add">+ } </span><span class="cx"> String value = prop.getStringValue(); </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserverauthprefsSubjectPreferencesCachejava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesCache.java (4840 => 4841)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesCache.java 2009-08-10 18:28:34 UTC (rev 4840) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/prefs/SubjectPreferencesCache.java 2009-08-10 19:36:41 UTC (rev 4841) </span><span class="lines">@@ -39,7 +39,8 @@ </span><span class="cx"> } private void load(int subjectId) { </span><span class="rem">- if (!subjectPreferences.containsKey(subjectId)) { </span><span class="add">+ // if subject ID is 0, it probably means this is a new LDAP user that needs to be registered + if (subjectId != 0 && !subjectPreferences.containsKey(subjectId)) { </span><span class="cx"> try { Subject subject = subjectManager.loadUserConfiguration(subjectId); Configuration configuration = subject.getUserConfiguration(); </span> </pre> </div> </div> </body> </html> |