tce_functions_authorization.php

Functions for Authorization / LOGIN

Source: shared/code/tce_functions_authorization.php

Functions for Authorization / LOGIN

Functions

F_check_current_user_password()

Returns true if the password matches the stored password of the current session user.

Every check fails while F_get_current_user_password_lock_time() is greater than 0.

function F_check_current_user_password(mixed $password): bool

Parameters:

  • $password (mixed): Password to check.

Returns: bool: True if the password is correct.

Source: shared/code/tce_functions_authorization.php:293

F_get_current_user_password_lock_time()

Returns the number of seconds left before the current user’s password can be checked again.

The check is locked for 15 minutes after 5 consecutive failures in the same session.

function F_get_current_user_password_lock_time(): int

Returns: int: Remaining lock time in seconds, 0 if the check is not locked.

Source: shared/code/tce_functions_authorization.php:274

F_getAuthorizedUsers()

Returns a comma separated string of ID of the users that belong to the same groups.

function F_getAuthorizedUsers(mixed $user_id): string

Parameters:

  • $user_id (mixed): (int) user ID

Returns: string

Source: shared/code/tce_functions_authorization.php:473

F_getSSLCertificateHash()

Get the hash code of the specified SSL certificate

function F_getSSLCertificateHash(string $cert, bool $pkcs12 = false): array

Parameters:

  • $cert (string): String containing the certificate data.
  • $pkcs12 (bool): Set this variable to true if the certificate is in PKCS12 format.

Returns: array: containing the hash code and the validity end date in unix epoch.

Source: shared/code/tce_functions_authorization.php:597

F_getSSLClientHash()

Get the hash code for the client certificate

function F_getSSLClientHash(): string

Returns: string: containing the hash code.

Source: shared/code/tce_functions_authorization.php:632

F_has_current_user_password()

Returns true if the current session user can confirm actions with the stored password.

Returns false for sessions opened through SSL client certificate, CAS or Shibboleth, where the stored password is generated at login and unknown to the user.

function F_has_current_user_password(): bool

Returns: bool: True if the current user’s password can be checked.

Source: shared/code/tce_functions_authorization.php:263

F_isAuthorizedQuestion()

Returns true if the current user is authorized to edit the specified question and its answers.

function F_isAuthorizedQuestion(mixed $question_id): bool

Parameters:

  • $question_id (mixed): (int) question ID

Returns: bool: true if the question exists and the user is authorized for its subject, false otherwise

Source: shared/code/tce_functions_authorization.php:427

F_isAuthorizedSubject()

Returns true if the current user is authorized to edit the specified subject and its content.

The user must be authorized for the subject or for its parent module.

function F_isAuthorizedSubject(mixed $subject_id): bool

Parameters:

  • $subject_id (mixed): (int) subject ID

Returns: bool: true if the subject exists and the user is authorized, false otherwise

Source: shared/code/tce_functions_authorization.php:402

F_isAuthorizedTestUser()

Returns true if the current user is authorized for the test of the specified test-user record.

function F_isAuthorizedTestUser(mixed $testuser_id): bool

Parameters:

  • $testuser_id (mixed): (int) test-user ID

Returns: bool: true if the record exists and the user is authorized for its test, false otherwise

Source: shared/code/tce_functions_authorization.php:449

F_isAuthorizedUser()

Returns true if the current user is authorized to update and delete the selected database record.

function F_isAuthorizedUser(
    mixed $table,
    mixed $field_id_name,
    mixed $value_id,
    mixed $field_user_id
): bool

Parameters:

  • $table (mixed): (string) table to be modified
  • $field_id_name (mixed): (string) name of the main ID field of the table
  • $value_id (mixed): (int) value of the ID field of the table
  • $field_user_id (mixed): (string) name of the foreign key to to user_id

Returns: bool: true if the user is authorized, false otherwise

Source: shared/code/tce_functions_authorization.php:333

F_isSslCertificateValid()

Check if the client has a valid SSL certificate.

function F_isSslCertificateValid(): true

Returns: true: if the client has a valid SSL certificate, false otherwise.

Source: shared/code/tce_functions_authorization.php:570

F_login_form()

Display login page.

NOTE: This function calls exit() after execution.

function F_login_form()

Source: shared/code/tce_functions_authorization.php:156

F_loginForm()

Returns XHTML / CSS formatted string for login form.<br> The CSS classes used are: <ul> <li>div.login_form : container for login box</li> <li>div.login_form div.login_row : container for label + input field or button</li> <li>div.login_form div.login_row span.label : container for input label</li> <li>div.login_form div.login_row span.formw : container for input form</li> </ul>

function F_loginForm(
    mixed $faction,
    mixed $fid,
    mixed $fmethod,
    mixed $fenctype,
    mixed $username
): XHTML

Parameters:

  • $faction (mixed)
  • $fid (mixed)
  • $fmethod (mixed)
  • $fenctype (mixed)
  • $username (mixed)

Returns: XHTML: string for login form

Source: shared/code/tce_functions_authorization.php:39

F_logout_form()

Display logout form.

function F_logout_form(): XHTML

Returns: XHTML: string for logout form.

Source: shared/code/tce_functions_authorization.php:210

F_logout_page()

Display logout page.

NOTE: This function calls exit() after execution.

function F_logout_page()

Source: shared/code/tce_functions_authorization.php:245

F_syncUserGroups()

Sync user groups with the ones specified on the configuration file for alternate authentication.

function F_syncUserGroups(mixed $usrid, mixed $grpids)

Parameters:

  • $usrid (mixed): (int) ID of the user to update.
  • $grpids (mixed): (mixed) Group ID or comma separated list of group IDs (0=all available groups).

Source: shared/code/tce_functions_authorization.php:503