AuthAccessLog
abstract class AuthAccessLog extends BaseAppLog
Provides a base class for apps that use the Authenticator to log auth info
Constants
| IDLength |
|
Properties
| protected | $database | The object's primary reference to the database |
from BaseObject |
| protected Scalar> | $scalars | from BaseObject | |
| protected ObjectRef> | $objects | from BaseObject | |
| protected ObjectRefs> | $objectrefs | from BaseObject | |
| private | $modified | whether or not this object has been modified |
from BaseObject |
| private | $deleted | whether or not this object has been deleted |
from BaseObject |
| private | $dbDeleted | whether or not this object has been deleted by DB |
from BaseObject |
| private | $deleteLater | from BaseObject | |
| private | $created | True if this object has been created and not yet saved to DB |
from BaseObject |
| protected | $actionlog | from BaseAppLog | |
| protected | $details | cached array of details log so we can set it once only in Save() |
from BaseAppLog |
Methods
Gets a template array of the object's properties (columns).
Returns the name of the class that should be used in the database for the table name (cast down at save)
Counts objects in the DB matching the given query
Loads an array of objects from the DB matching the given query
Deletes objects from the DB matching the given query
Loads a unique object matching the given query
Loads all objects of this type from the database
Loads objects from the database with the given object ID as the value of the given field
Deletes objects from the database with the given object ID as the value of the given field
Loads a unique object matching the given field
Deletes a unique object matching the given field
Loads objects from the database with the given object referenced by the given field
Deletes objects from the database with the given object referenced by the given field
Loads a unique object from the database with the given object referenced by the given field
Deletes a unique object from the database with the given object referenced by the given field
Returns the string "id:class" where id is the object ID and class is its short class name
Same as GetScalar() but returns null instead of throwing exceptions
Returns the delta of the given scalar (non-zero if modified)
Same as GetObject() but returns null instead of throwing exceptions
Checks if the object reference is not-null without actually loading it (faster)
Gets the ID of a referenced object without actually loading it (faster)
Same as GetObjectID() but returns null instead of throwing exceptions
Gets the class name of a referenced object without actually loading it (faster)
Gets the class name of a referenced object without actually loading it (faster)
Gets an array of objects that reference this object
Gets the counter of objects referencing this object
Loads the object that joins together two classes using a FieldTypes\ObjectJoin
Same as GetJoinObject() but returns null instead of throwing exceptions
Deletes all objects that reference this object
Sets a scalar field to the given value
Increments a counter field by the given delta (thread safe)
Sets a field to reference the given object
Same as BoolSetObject() but returns $this
Adds the given object to a collection of referenced objects
Removes the given object from a collection of referenced objects
Constructs the object by initializing its field template with values from the database
Function to allow subclasses to do something after being constructed without overriding the constructor
Collects fields that have changed and saves them to the database
whether or not this object has been, or should be considered, deleted
True if this object has been created and not yet saved to DB (should not be overriden)
Creates a new object of this type in the database and returns it
Returns the CLI usage string for loading objects by properties
Adds query filter parameters using the given input
Returns a compiled query selecting rows from the given input
Returns true if the configured details log detail level is >= full
Adds the given arbitrary data to the log's "details" field
Creates a new empty applog object and binds it to the current action log
Returns the common CLI property usage for all app logs (joined to ActionLog)
Returns the printable client object of this AuthAccessLog
Returns the full printable client object for this app log
Returns a new self object with the given auth info logged
Returns whether or not the Authenticator had admin status, or null auth was null
No description
No description
No description
Details
at line 19
static array
GetFieldTemplate()
Gets a template array of the object's properties (columns).
This template will be copied into the object when it is constructed. If a field maps to null, a basic Scalar fieldtype will be used.
in
BaseObject at line 52
static string
GetDBClass()
Returns the name of the class that should be used in the database for the table name (cast down at save)
Defaults to the actual class used. Can be overriden e.g. if multiple classes need to use the same table.
in
BaseObject at line 60
static string
GetObjClass(array $row)
No description
in
BaseObject at line 68
static int
CountByQuery(ObjectDatabase $database, QueryBuilder $query)
Counts objects in the DB matching the given query
in
BaseObject at line 79
static array
LoadByQuery(ObjectDatabase $database, QueryBuilder $query)
Loads an array of objects from the DB matching the given query
in
BaseObject at line 92
static int
DeleteByQuery(ObjectDatabase $database, QueryBuilder $query)
Deletes objects from the DB matching the given query
The objects are loaded when they are deleted and their Delete()s are run
in
BaseObject at line 103
static BaseObject|null
TryLoadUniqueByQuery(ObjectDatabase $database, QueryBuilder $query)
Loads a unique object matching the given query
in
BaseObject at line 116
static BaseObject
NotNull(BaseObject|null $obj)
Asserts that the given object is not null
in
BaseObject at line 127
static BaseObject|null
TryLoadByID(ObjectDatabase $database, string $id)
Loads a unique object by its ID
in
BaseObject at line 137
static void
DeleteByID(ObjectDatabase $database, string $id)
Deletes a unique object by its ID
in
BaseObject at line 150
static array
LoadAll(ObjectDatabase $database, int|null $limit = null, int|null $offset = null)
Loads all objects of this type from the database
in
BaseObject at line 160
static int
DeleteAll(ObjectDatabase $database)
Deletes all objects of this type from the database
in
BaseObject at line 176
static array
LoadByObjectID(ObjectDatabase $database, string $field, string $id, string|null $class = null)
Loads objects from the database with the given object ID as the value of the given field
Can be used as an alternative to LoadByObject() to avoid actually loading the object
in
BaseObject at line 193
static int
DeleteByObjectID(ObjectDatabase $database, string $field, string $id, string|null $class = null)
Deletes objects from the database with the given object ID as the value of the given field
Can be used as an alternative to DeleteByObject() to avoid actually loading the object
in
BaseObject at line 206
static protected BaseObject|null
TryLoadUniqueByKey(ObjectDatabase $database, string $field, string $key)
Loads a unique object matching the given field
in
BaseObject at line 218
static protected bool
TryDeleteByUniqueKey(ObjectDatabase $database, string $field, string $key)
Deletes a unique object matching the given field
in
BaseObject at line 233
static array
LoadByObject(ObjectDatabase $database, string $field, BaseObject $object, bool $isPoly = false)
Loads objects from the database with the given object referenced by the given field
in
BaseObject at line 247
static int
DeleteByObject(ObjectDatabase $database, string $field, BaseObject $object, bool $isPoly = false)
Deletes objects from the database with the given object referenced by the given field
in
BaseObject at line 261
static BaseObject|null
TryLoadUniqueByObject(ObjectDatabase $database, string $field, BaseObject $object, bool $isPoly = false)
Loads a unique object from the database with the given object referenced by the given field
in
BaseObject at line 275
static bool
TryDeleteByUniqueObject(ObjectDatabase $database, string $field, BaseObject $object, bool $isPoly = false)
Deletes a unique object from the database with the given object referenced by the given field
in
BaseObject at line 284
string
ID()
Returns the unique ID of the object
in
BaseObject at line 287
string
__toString()
Returns the string "id:class" where id is the object ID and class is its short class name
in
BaseObject at line 290
static string|null
toString(BaseObject|null $obj)
Returns the given object's as a string if not null, else null
in
BaseObject at line 309
protected mixed
GetScalar(string $field, bool $allowTemp = true)
Gets a scalar field
in
BaseObject at line 322
protected
TryGetScalar(string $field, bool $allowTemp = true)
Same as GetScalar() but returns null instead of throwing exceptions
in
BaseObject at line 336
protected int
GetScalarDelta(string $field)
Returns the delta of the given scalar (non-zero if modified)
in
BaseObject at line 351
protected BaseObject
GetObject(string $field)
Gets a single object reference
in
BaseObject at line 365
protected BaseObject|null
TryGetObject(string $field)
Same as GetObject() but returns null instead of throwing exceptions
in
BaseObject at line 379
protected bool
HasObject(string $field)
Checks if the object reference is not-null without actually loading it (faster)
in
BaseObject at line 394
protected string
GetObjectID(string $field)
Gets the ID of a referenced object without actually loading it (faster)
in
BaseObject at line 408
protected string|null
TryGetObjectID(string $field)
Same as GetObjectID() but returns null instead of throwing exceptions
in
BaseObject at line 422
protected string
GetObjectType(string $field)
Gets the class name of a referenced object without actually loading it (faster)
in
BaseObject at line 438
protected string|null
TryGetObjectType(string $field)
Gets the class name of a referenced object without actually loading it (faster)
in
BaseObject at line 451
protected BaseObject
DeleteObject(string $field)
Deletes the object referenced in the field
in
BaseObject at line 467
protected array
GetObjectRefs(string $field, int|null $limit = null, int|null $offset = null)
Gets an array of objects that reference this object
in
BaseObject at line 481
protected int
CountObjectRefs(string $field)
Gets the counter of objects referencing this object
in
BaseObject at line 497
protected StandardObject
GetJoinObject(string $field, BaseObject $obj)
Loads the object that joins together two classes using a FieldTypes\ObjectJoin
in
BaseObject at line 514
protected StandardObject|null
TryGetJoinObject(string $field, BaseObject $obj)
Same as GetJoinObject() but returns null instead of throwing exceptions
in
BaseObject at line 530
protected BaseObject
DeleteObjects(string $field)
Deletes all objects that reference this object
in
BaseObject at line 546
protected BaseObject
SetScalar(string $field, mixed $value, bool $temp = false)
Sets a scalar field to the given value
in
BaseObject at line 571
protected BaseObject
DeltaCounter(string $field, int $delta)
Increments a counter field by the given delta (thread safe)
in
BaseObject at line 598
protected bool
BoolSetObject(string $field, BaseObject|null $object, bool $notification = false)
Sets a field to reference the given object
Will also call SetObject or AddObjectRef on the given object as appropriate for two-way references
in
BaseObject at line 649
protected BaseObject
SetObject(string $field, BaseObject|null $object, bool $notification = false)
Same as BoolSetObject() but returns $this
in
BaseObject at line 664
protected bool
AddObjectRef(string $field, BaseObject $object, bool $notification = false)
Adds the given object to a collection of referenced objects
Will also call SetObject on the given object to actually create the reference
in
BaseObject at line 696
protected bool
RemoveObjectRef(string $field, BaseObject $object, bool $notification = false)
Removes the given object from a collection of referenced objects
in
BaseObject at line 727
__construct(ObjectDatabase $database, array $data)
Constructs the object by initializing its field template with values from the database
in
BaseObject at line 750
private
AddField(string $key, Scalar $field)
Adds the given field object to the correct internal array
in
BaseObject at line 763
protected void
SubConstruct()
Function to allow subclasses to do something after being constructed without overriding the constructor
in
BaseAppLog at line 91
BaseObject
Save(bool $onlyMandatory = false)
Collects fields that have changed and saves them to the database
in
BaseObject at line 814
bool
isDeleted()
whether or not this object has been, or should be considered, deleted
This function can be overriden with a custom validity-check, and is used as a filter when loading objects
in
BaseObject at line 820
void
NotifyDBDeleted()
Deletes this object without sending to the DB
in
BaseObject at line 823
void
Delete()
Deletes this object from the DB
in
BaseObject at line 849
protected void
DeleteLater()
Schedules the object to be deleted when Save() is called
in
BaseObject at line 855
bool
isCreated()
True if this object has been created and not yet saved to DB (should not be overriden)
in
BaseObject at line 861
static protected BaseObject
BaseCreate(ObjectDatabase $database)
Creates a new object of this type in the database and returns it
at line 56
static string
GetPropUsage()
Returns the CLI usage string for loading objects by properties
at line 58
static array
GetPropCriteria(ObjectDatabase $database, QueryBuilder $q, Input $input)
Adds query filter parameters using the given input
MUST prefix column names with the appropriate table name
in
BaseLog at line 37
static string
GetLoadUsage()
Returns the common CLI usage for loading log entries
in
BaseLog at line 40
static string
GetCountUsage()
Returns the common CLI usage for counting log entries
in
BaseLog at line 48
static protected QueryBuilder
GetWhereQuery(ObjectDatabase $database, Input $input)
Returns a compiled query selecting rows from the given input
in
BaseLog at line 66
static array
LoadByInput(ObjectDatabase $database, Input $input)
Loads log entries the given input
in
BaseLog at line 83
static int
CountByInput(ObjectDatabase $database, Input $input)
Counts log entries by the given input
in
BaseAppLog at line 24
protected ActionLog
GetActionLog()
Returns the ActionLog parent for this entry
in
BaseAppLog at line 35
static int
GetDetailsLevel()
Returns the configured details log detail level
If 0, details logs will be discarded, else see Config enum
in
BaseAppLog at line 41
static bool
isFullDetails()
Returns true if the configured details log detail level is >= full
in
BaseAppLog at line 53
BaseAppLog
LogDetails(string $key, mixed $data)
Adds the given arbitrary data to the log's "details" field
in
BaseAppLog at line 59
array
GetDetailsRef()
Returns a direct reference to the "details" log
in
BaseAppLog at line 66
static BaseAppLog|null
BaseRunCreate(ObjectDatabase $database)
Creates a new empty applog object and binds it to the current action log
in
BaseAppLog at line 81
BaseAppLog
SaveDetails()
Send the cached details log to the action log
in
BaseAppLog at line 100
static string
GetBasePropUsage()
Returns the common CLI property usage for all app logs (joined to ActionLog)
at line 83
array
GetClientObject(bool $expand = false)
Returns the printable client object of this AuthAccessLog
in
BaseAppLog at line 121
array
GetFullClientObject(bool $expand = false)
Returns the full printable client object for this app log
at line 36
static AuthAccessLog|null
BaseAuthCreate(ObjectDatabase $database, Authenticator|null $auth)
Returns a new self object with the given auth info logged
at line 54
bool|null
isAdmin()
Returns whether or not the Authenticator had admin status, or null auth was null
at line 71
private Account|null
TryGetAccount()
No description
at line 72
private Account|null
TryGetSudouser()
No description
at line 73
private Client|null
TryGetClient()
No description