Interface ProfilePrivacyLogic


  • public interface ProfilePrivacyLogic
    An interface for dealing with ProfilePrivacy in Profile2
    Author:
    Steve Swinsburg (steve.swinsburg@gmail.com)
    • Method Detail

      • getPrivacyRecordForUser

        ProfilePrivacy getPrivacyRecordForUser​(String userId)
        Retrieve the profile privacy record from the database for this user. If none exists, will attempt to create one for the user. If that also fails, will return null.

        Defaults to using the cached version where possible

        Parameters:
        userId - uuid of the user to retrieve the record for
        Returns:
        ProfilePrivacy record or null
      • getPrivacyRecordForUser

        ProfilePrivacy getPrivacyRecordForUser​(String userId,
                                               boolean useCache)
        Retrieve the privacy record from the database for this user but the caller has the option on whether or not to use the cached version (PRFL-504)
        Parameters:
        userId - uuid of the user to retrieve the record for
        useCache - whether or not to use the cache
        Returns:
        ProfilePrivacy record or null
      • savePrivacyRecord

        boolean savePrivacyRecord​(ProfilePrivacy profilePrivacy)
        Save the profile privacy record to the database
        Parameters:
        profilePrivacy - the record for the user
      • isActionAllowed

        boolean isActionAllowed​(String userX,
                                String userY,
                                PrivacyType type)
        Has the user allowed the other user to perform a certain action or view a piece of content?

        Most profile privacy actions are dealt with here.

        Parameters:
        userX - the uuid of the user that will have the action performed on them
        userY - uuid of user requesting to do the action
        type - PrivacyType enum
        Returns:
        true if allowed, false if not.
        Since:
        1.5
      • isBirthYearVisible

        boolean isBirthYearVisible​(String uuid)
        Has the user allowed viewing of their birth year in their profile. This is either on or off and does not depend on friends etc which is why it is not included above.
        Parameters:
        uuid - the uuid of the user we are querying
        Returns:
        boolean