MetaFox

UserPrivacy
in package
implements PrivacyForSettingInterface

Class UserPrivacy.

Tags
see
UserPrivacy
todo

should cache.

Table of Contents

Interfaces

PrivacyForSettingInterface
Interface PrivacyForSettingInterface.

Constants

CACHE_LIFETIME  = 3000
CACHE_NAME_USER_PRIVACY  = 'user_privacy'
CACHE_NAME_USER_PRIVACY_TYPES  = 'user_privacy_types'

Properties

$menuItemRepository  : MenuItemRepositoryInterface
$repository  : UserPrivacyRepositoryInterface

Methods

__construct()  : mixed
getDefaultPrivacy()  : int
getItemPrivacySetting()  : false|mixed
getPrivacyOptionsPhrase()  : array<int, string>
getProfileMenuSetting()  : false|mixed
getProfileSetting()  : int|false
getUserPrivacy()  : array<string, mixed>
hasAccess()  : bool
Check has accessibility of an user on owner privacy.
hasAccessProfileMenuSettings()  : array<string, mixed>
hasAccessProfileSettings()  : array<string, mixed>
validateItemPrivacySettings()  : bool
validateProfileMenuSettings()  : bool
validateProfileSettings()  : bool
getMenuItemOfUserByMenu()  : Collection
handleProfileMenuMobile()  : array<string|int, mixed>
checkPrivacy()  : mixed
getHasAccessForSettings()  : array<string, mixed>
getPrivacyTypesByEntity()  : array<string, mixed>
Get privacy types fromm all apps with value stored in database.
hasPrivacyMember()  : bool
hasPrivacyOnlyMe()  : bool
isFriendOfFriend()  : bool
validateUserSettings()  : void

Constants

CACHE_NAME_USER_PRIVACY

public mixed CACHE_NAME_USER_PRIVACY = 'user_privacy'

CACHE_NAME_USER_PRIVACY_TYPES

public mixed CACHE_NAME_USER_PRIVACY_TYPES = 'user_privacy_types'

Properties

$menuItemRepository

protected MenuItemRepositoryInterface $menuItemRepository

Methods

getDefaultPrivacy()

public getDefaultPrivacy() : int
Return values
int

getItemPrivacySetting()

public getItemPrivacySetting(int $userId, string $privacyName) : false|mixed
Parameters
$userId : int
$privacyName : string
Return values
false|mixed

getPrivacyOptionsPhrase()

public getPrivacyOptionsPhrase() : array<int, string>
Return values
array<int, string>

getProfileMenuSetting()

public getProfileMenuSetting(int $userId, string $privacyName) : false|mixed
Parameters
$userId : int
$privacyName : string
Return values
false|mixed

getProfileSetting()

public getProfileSetting(int $userId, string $privacyName) : int|false
Parameters
$userId : int
$privacyName : string
Return values
int|false

getUserPrivacy()

public getUserPrivacy(int $userId) : array<string, mixed>
Parameters
$userId : int
Return values
array<string, mixed>

hasAccess()

Check has accessibility of an user on owner privacy.

public hasAccess(User $user, User $owner, string $privacySettingName) : bool

Do not check isBlocked in here, use: PrivacyPolicy::checkPermissionOwner($user, $owner) before this method.

Parameters
$user : User
  • current user id.
$owner : User
  • target user id.
$privacySettingName : string
Tags
SuppressWarnings

(PHPMD.CyclomaticComplexity)

Return values
bool

hasAccessProfileMenuSettings()

public hasAccessProfileMenuSettings(User $user, User $owner) : array<string, mixed>
Parameters
$user : User
$owner : User
Return values
array<string, mixed>

hasAccessProfileSettings()

public hasAccessProfileSettings(User $user, User $owner) : array<string, mixed>
Parameters
$user : User
$owner : User
Return values
array<string, mixed>

validateItemPrivacySettings()

public validateItemPrivacySettings(int $userId, array<string, int> $params) : bool
Parameters
$userId : int
$params : array<string, int>
Tags
throws
ValidationException
Return values
bool

validateProfileMenuSettings()

public validateProfileMenuSettings(int $userId, array<string, int> $params) : bool
Parameters
$userId : int
$params : array<string, int>
Tags
throws
ValidationException
Return values
bool

validateProfileSettings()

public validateProfileSettings(int $userId, array<string, int> $params) : bool
Parameters
$userId : int
$params : array<string, int>
Tags
throws
ValidationException
Return values
bool

getMenuItemOfUserByMenu()

protected getMenuItemOfUserByMenu() : Collection
Return values
Collection

handleProfileMenuMobile()

protected handleProfileMenuMobile(array<string|int, mixed> $menuSettings, array<string|int, mixed> $menu) : array<string|int, mixed>
Parameters
$menuSettings : array<string|int, mixed>
$menu : array<string|int, mixed>
Return values
array<string|int, mixed>

checkPrivacy()

private checkPrivacy(User $user, User $owner, int $privacy, int $privacyId) : mixed
Parameters
$user : User
$owner : User
$privacy : int
$privacyId : int

getHasAccessForSettings()

private getHasAccessForSettings(array<string, mixed> $settings, User $user, User $owner) : array<string, mixed>
Parameters
$settings : array<string, mixed>
$user : User
$owner : User
Tags
SuppressWarnings

(PHPMD)

Return values
array<string, mixed>

getPrivacyTypesByEntity()

Get privacy types fromm all apps with value stored in database.

private getPrivacyTypesByEntity(string $entityType) : array<string, mixed>
Parameters
$entityType : string
Return values
array<string, mixed>

hasPrivacyMember()

private hasPrivacyMember(int $userId, int $privacyId) : bool
Parameters
$userId : int
$privacyId : int
Return values
bool

hasPrivacyOnlyMe()

private hasPrivacyOnlyMe(User $user, User $owner) : bool
Parameters
$user : User
$owner : User
Return values
bool

isFriendOfFriend()

private isFriendOfFriend(int $userId, int $ownerId, int $privacyId) : bool
Parameters
$userId : int
$ownerId : int
$privacyId : int
Tags
todo

check isFriendOfFriend.

Return values
bool

validateUserSettings()

private validateUserSettings(array<string, mixed> $allows, array<string, mixed> $params, string $message) : void
Parameters
$allows : array<string, mixed>
$params : array<string, mixed>
$message : string
Tags
throws
ValidationException

        
On this page

Search results