Global_Visibility extends Abstract_Visibility implements Visibility_Interface

This class represents the global visibility settings for documents.

It determines document visibility based on site-wide settings.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Visibility_Interface

Table of Contents

$data_object  : object
The object to retrieve the visibility
$document_owner  : bool
The document owner can access the document.
$object_id  : int
The object id.
$object_type  : string
The type of object. (document, category, global_setting)
$passwords  : array<string|int, mixed>
Array of passwords that can be used to access the document.
$roles  : array<string|int, mixed>
Array of roles that can access the document.
$users  : array<string|int, mixed>
Array of users that can access the document.
$visibility  : string
The visibility level.
__construct()  : mixed
Constructor.
correct_password_entered()  : bool
Check the correct password has been entered.
current_user_allowed_by_id()  : bool
Is the current user allowed access to this document by ID?
current_user_allowed_by_role()  : bool
Is the current user allowed access to this category by role?
get_data_object()  : object
Retrieve the object.
get_document_owner()  : array<string|int, mixed>|false
Get the document owner for this category.
get_object_id()  : int
Retrieve the object id.
get_object_type()  : string
Retrieve the object type.
get_passwords()  : array<string|int, mixed>
Retrieve the list of passwords for this term.
get_protection_data()  : array<string|int, mixed>
Retrieve all the protection data for this term.
get_protection_types()  : mixed
Retrieve all the active protection types for this document.
get_roles()  : array<string|int, mixed>
Retrieve the list of roles for this term.
get_users()  : array<string|int, mixed>
Retrieve the list of users for this term.
get_visibility()  : string
Retrieve the visibility level for this term.
has_document_owner_protection()  : bool
Does this object have document owner protection?
has_password_protection()  : bool
Does this object have password protection?
has_protection()  : bool
Does this object have any form of protection?
has_role_protection()  : bool
Does this object have role protection?
has_user_protection()  : bool
Does this object have user protection?
initialize_visbility_data()  : mixed
Initialize visibility data.
is_hidden()  : bool
Is this document hidden?
is_inherited()  : bool
Is this visibility level inherited?
is_password_protected()  : bool
Is this a password protected document?
is_protected()  : bool
Is this document protected? 'Protected' can mean a password is required, or the document is locked to specific roles or users.
is_public()  : bool
Is this a public document?
is_role_protected()  : bool
Is this document protected by user role?
is_unlocked()  : bool
Is this object unlocked by password, role, or user?
is_unlocked_by_password()  : bool
Is this object unlocked by password?
is_unlocked_by_role()  : bool
Is this object unlocked by role?
is_unlocked_by_user()  : bool
Is this category unlocked by the current user?
is_user_protected()  : bool
Is this document protected by user (i.e. only specific users have access)?

Properties

$data_object

The object to retrieve the visibility

protected object $data_object
Tags

$document_owner

The document owner can access the document.

protected bool $document_owner = false
Tags

$object_type

The type of object. (document, category, global_setting)

protected string $object_type
Tags

$passwords

Array of passwords that can be used to access the document.

protected array<string|int, mixed> $passwords = []
Tags

$roles

Array of roles that can access the document.

protected array<string|int, mixed> $roles = []
Tags

$users

Array of users that can access the document.

protected array<string|int, mixed> $users = []
Tags

Methods

__construct()

Constructor.

public __construct() : mixed
Tags
Return values
mixed

correct_password_entered()

Check the correct password has been entered.

public correct_password_entered() : bool
Tags
Return values
bool

current_user_allowed_by_id()

Is the current user allowed access to this document by ID?

public current_user_allowed_by_id() : bool
Tags
Return values
bool

true if the current user is allowed access.

current_user_allowed_by_role()

Is the current user allowed access to this category by role?

public current_user_allowed_by_role() : bool
Tags
Return values
bool

true if the current user has one of the required roles.

get_data_object()

Retrieve the object.

public get_data_object() : object
Tags
Return values
object

get_document_owner()

Get the document owner for this category.

public get_document_owner() : array<string|int, mixed>|false
Tags
Return values
array<string|int, mixed>|false

The document owner, or false if none set

get_object_id()

Retrieve the object id.

public get_object_id() : int
Tags
Return values
int

get_object_type()

Retrieve the object type.

public get_object_type() : string
Tags
Return values
string

get_passwords()

Retrieve the list of passwords for this term.

public get_passwords() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_protection_data()

Retrieve all the protection data for this term.

public get_protection_data() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_protection_types()

Retrieve all the active protection types for this document.

public get_protection_types() : mixed
Tags
Return values
mixed

get_roles()

Retrieve the list of roles for this term.

public get_roles() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_users()

Retrieve the list of users for this term.

public get_users() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_visibility()

Retrieve the visibility level for this term.

public get_visibility() : string
Tags
Return values
string

has_document_owner_protection()

Does this object have document owner protection?

public has_document_owner_protection() : bool
Tags
Return values
bool

true if document owner protected

has_password_protection()

Does this object have password protection?

public has_password_protection() : bool
Tags
Return values
bool

true if password protected

has_protection()

Does this object have any form of protection?

public has_protection() : bool
Tags
Return values
bool

has_role_protection()

Does this object have role protection?

public has_role_protection() : bool
Tags
Return values
bool

true if role protected

has_user_protection()

Does this object have user protection?

public has_user_protection() : bool
Tags
Return values
bool

true if user protected

initialize_visbility_data()

Initialize visibility data.

public initialize_visbility_data() : mixed
Tags
Return values
mixed

is_hidden()

Is this document hidden?

public is_hidden([bool $include_ancestors = false ]) : bool
Parameters
$include_ancestors : bool = false

Signature is not used.

Tags
Return values
bool

true if hidden, false if not

is_inherited()

Is this visibility level inherited?

public is_inherited() : bool
Tags
Return values
bool

is_password_protected()

Is this a password protected document?

public is_password_protected([bool $check_ancestors = false ]) : bool
Parameters
$check_ancestors : bool = false

Whether to check the password against ancestor documents

Tags
Return values
bool

true if password protected, false if not

is_protected()

Is this document protected? 'Protected' can mean a password is required, or the document is locked to specific roles or users.

public is_protected() : bool
Tags
Return values
bool

true if this document is protected.

is_public()

Is this a public document?

public is_public() : bool
Tags
Return values
bool

true if the document is public, false if not

is_role_protected()

Is this document protected by user role?

public is_role_protected([bool $check_ancestors = false ]) : bool
Parameters
$check_ancestors : bool = false

Whether to check the ancestor categories as well (if any).

Tags
Return values
bool

true if this category is role protected.

is_unlocked()

Is this object unlocked by password, role, or user?

public is_unlocked() : bool
Tags
Return values
bool

true if unlocked.

is_unlocked_by_password()

Is this object unlocked by password?

public is_unlocked_by_password() : bool
Tags
Return values
bool

true if unlocked, false otherwise

is_unlocked_by_role()

Is this object unlocked by role?

public is_unlocked_by_role() : bool
Tags
Return values
bool

true if role protected and the current user has one of the required roles.

is_unlocked_by_user()

Is this category unlocked by the current user?

public is_unlocked_by_user() : bool
Tags
Return values
bool

true if user protected and the current user is allowed access.

is_user_protected()

Is this document protected by user (i.e. only specific users have access)?

public is_user_protected([bool $check_ancestors = false ]) : bool
Parameters
$check_ancestors : bool = false

Whether to check the ancestor documents as well (if any).

Tags
Return values
bool

true if this document is user protected.

Search results