Document_Visibility extends Abstract_Visibility implements Visibility_Interface
This class represents a document (Document instance) with various functions to test for its visibility.
It's constructed from the Document object rather than extending it.
Tags
Interfaces, Classes and Traits
Table of Contents
- $object_type : string
- The type of object this visibility is for.
- $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.
- $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.
- $global_visibility : Global_Visibility
- The global visibility instance.
- __construct() : mixed
- Constructor.
- correct_password_entered() : bool
- Check the correct password has been entered.
- current_user_allowed_by_document_owner_id() : bool
- Is the current user allowed access to this document by document owner ID?
- 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() : Document
- Retrieve the document 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 the visibility data for this document.
- 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_document_owner() : bool
- Is this document unlocked by document owner?
- 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
$object_type
The type of object this visibility is for.
public
string
$object_type
= 'document'
Tags
$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_id
The object id.
protected
int
$object_id
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
$visibility
The visibility level.
protected
string
$visibility
Tags
$global_visibility
The global visibility instance.
private
Global_Visibility
$global_visibility
= null
Tags
Methods
__construct()
Constructor.
public
__construct(Document $document) : mixed
Parameters
- $document : Document
-
The document to retrieve the visibility for
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_document_owner_id()
Is the current user allowed access to this document by document owner ID?
public
current_user_allowed_by_document_owner_id() : 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()
Retrieve the document object.
public
get_document() : Document
Tags
Return values
Document —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 the visibility data for this document.
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 $include_ancestors = false ]) : bool
Parameters
- $include_ancestors : bool = false
-
Whether to check the password against ancestor protections
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 $include_ancestors = true ]) : bool
Parameters
- $include_ancestors : bool = true
-
Whether to check the ancestor documents as well (if any).
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 $include_ancestors = false ]) : bool
Parameters
- $include_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_document_owner()
Is this document unlocked by document owner?
public
is_unlocked_by_document_owner() : bool
Tags
Return values
bool —true if this document is unlocked by document owner.
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 $include_ancestors = false ]) : bool
Parameters
- $include_ancestors : bool = false
-
Whether to check the ancestor documents as well (if any).
Tags
Return values
bool —true if this document is user protected.