import javax.inject.Named;
import org.mxchange.addressbook.beans.login.UserLoginWebController;
import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
/**
* A web request bean for user profiles
public void setUser (final User user) {
this.user = user;
}
+
+ @Override
+ public boolean isProfileLinkVisible () {
+ // Default profile mode is not visible
+ ProfileMode profileMode = ProfileMode.INVISIBLE;
+
+ // Is the user set?
+ if (this.getUser() instanceof User) {
+ // Get profile mode from user
+ profileMode = this.getUser().getUserProfileMode();
+ }
+
+ // Check all conditions (except for admin)
+ // TODO: Add admin role somehow?
+ return ((profileMode.equals(ProfileMode.PUBLIC)) || (this.loginController.isUserLoggedIn()) && (profileMode.equals(ProfileMode.MEMBERS)));
+ }
}
* <p>
* @return User instance
*/
- public User getUser ();
+ User getUser ();
/**
* Setter for user instance
* <p>
* @param user User instance
*/
- public void setUser (final User user);
+ void setUser (final User user);
+
+ /**
+ * Checks if the user profile link is visible
+ * <p>
+ * @return Whether the profile link is visible
+ */
+ boolean isProfileLinkVisible ();
}