// Ask other method
return this.isProfileLinkVisible();
}
+
+ @Override
+ public boolean isProfileLinkVisibleByUser (final User user) {
+ // Is it correctly set?
+ if (null == user) {
+ // Throw NPE
+ throw new NullPointerException("user is null");
+ } else if (user.getUserId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("user.userId is null");
+ } else if (user.getUserId() < 1) {
+ // Invalid user id set
+ throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid.", user.getUserId()));
+ }
+
+ // Set user here
+ this.setUser(user);
+
+ // Ask other method
+ return this.isProfileLinkVisible();
+ }
}
*/
boolean isProfileLinkVisibleById (final Long userId);
+ /**
+ * Checks if given user's profile is visible
+ * <p>
+ * @param user User instance to check
+ * <p>
+ * @return Whether the user's profile is visible
+ */
+ boolean isProfileLinkVisibleByUser (final User user);
+
/**
* Getter for user instance
* <p>
<h:outputText id="userNotLoggedIn" class="notice" value="#{msg.USER_NOT_LOGGED_IN}" rendered="#{not loginController.isUserLoggedIn()}" />
<h:dataTable id="userList" headerClass="table_header_column" var="user" value="#{addressbookController.allUsersNotSharing()}" rendered="#{loginController.isUserLoggedIn() and not empty addressbookController.addressbook and not loginController.isInvisible()}">
- <c:set value="#{user}" target="#{profileController}" property="user" />
<h:column>
<f:facet name="header">#{msg.USER_ID}</f:facet>
<h:column>
<f:facet name="header">#{msg.LOGIN_START_SHARING_TITLE}</f:facet>
- <h:form acceptcharset="utf-8" id="startSharing" rendered="#{profileController.isProfileLinkVisible()}">
+ <h:form acceptcharset="utf-8" id="startSharing" rendered="#{profileController.isProfileLinkVisibleByUser(user)}">
<h:commandButton class="submit" id="submit" value="#{msg.LOGIN_START_SHARING_BUTTON}" action="#{shareController.startSharing(user, addressbookController.addressbook)}" title="#{msg.LOGIN_START_SHARING_BUTTON_TITLE}" />
</h:form>
</h:column>