App\Users

Inherited from cmsApplication_ManyToMany

Protected Attributes

protected $field_password= 'password'
protected $field_username= 'username'
protected $field_groupname= 'groupname'
protected $minimum_password_length= 7
protected $data_directories= array( 'avatar_original' => '/data/user/avatars/original', 'avatar_small' => '/data/user/avatars/small', 'avatar_medium' => '/data/user/avatars/medium', 'avatar_large' => '/data/user/avatars/large', 'user_public_images' => '/data/user/public/images', 'user_public_files' => '/data/user/public/files', )

Public Attributes

public $currentUserID 

Protected Methods

protected _internalCreateUser($datavalues, $creategroup=true)
protected recordUserActivity($user_id, $description)
protected getUserRealEmailAddress($email)
Verify the user email address
protected stringmodifyDataValuesBeforeSaveItem(array $datavalues)
$SystemLog
protected booleanchangePassword(int $id, string $newpassword)
Change a user's password
protected arraycheckPasswordQuality(string $password, string $password_verify)
Check password and return an array of error list
protected markPasswordResetRequestComplete($id)
protected getValidatedGroupIDs($group_ids)
protected hook_modifyDataValuesBeforeSaveObject(\SCHLIX\cmsApplication_List $obj, array $datavalues)
Hook - before save item
protected setUserSessionInformation(array $user, type $rememberpassword)
Set user information in the database $SystemDB
protected arraygetUserHistoryByID(int $user_id)
Returns all history for a specific user ID. It is assumed that the user ID is valid $SystemDB

Public Methods

public __construct()
public isBackendMode()
public determineBackendMode()
public stringgetFieldUsername()
Returns the username field name in the item table
public stringgetFieldGroupName()
Returns the groupname field name in the category table
public typegetRegisteredUsersCount()
Returns total user count
public stringcreateFriendlyURL(string $str)
create SEO friendly URL. Format is action={...}¶m1={....}¶m2={...}
public getPasswordFieldName()
public getUsernameFieldName()
public getFieldItemTitle()
public getItemsByCategoryID($id, $fields=' *', $extra_criteria='', $start, $end, $sortby='', $sortdirection='ASC', $from_cache=false)
public array|booleangetUserByUsernameAndPassword(type $input_username, type $input_password, type $input_groups=null)
Validate username & password and returns an array of the user info if authentication is successful, otherwise returns false $SystemDB
public recordCurrentUserActivity($description)
public arrayverifyUserNamePassword(string $input_username, string $input_password)
Verify username and password and returns the user info $SystemConfig
public userNameExists($input_username)
public getAllUserGroupNames($guest_included=true)
public getFailedLoginAttemptCount($input_username)
public recordFailedLoginAttempt($input_username)
public getUserNameByID($id, $from_cache=false)
public getUserByID($id, $from_cache=false)
public getUserInfoByID($id, $from_cache=false)
public getUserInfoByUserName($username)
public getUserByUserName($username)
public getUserByEmailAddress($input_email)
public booleangetCurrentUserInfo()
Return an array containing the current user ID
public intgetCurrentUserID()
Return the current user ID
public getCurrentUserGroups()
public getCurrentUserGroupNames()
public getUserGroupNames($user_id)
public isUserMemberOfGroupName($user_id, $groupname)
public isCurrentUserMemberOfGroupName($groupname)
public getCurrentUserGroupIDs()
public getCurrentUserName()
public displayUserInfoByID($user_id)
public getGroupIDByGroupName($catname)
public getGroupNameByGroupID($id)
public validateUserNameString($str)
public validateEmailAddressString($str)
public resetSession()
public debugSession()
public logout()
public adminAuthenticated()
public authenticated()
public generateRandomPasswordSalt($hash_type, $work_factor=9)
public typegenerateNewSaltAndHashedPassword(type $password, type $salt='')
Deprecated - generate password with salt. Use password_hash directly Deprecatedsince version 2.1.9-2 since version 2.1.9-2
public stringconvertIntoValidUserName(string $str)
Converts a string to an alphanumeric one (dash and underscores allowed)
public bool|array String arraygetValidationErrorListBeforeSaveItem($data)
Validates save item. If there's an error, it will return an array with one or more error string, otherwise it will return a boolean true $CurrentUser
public findDuplicateUsers($data)
public validateNewUserRegistration()
public sendRegistrationEmailToUserByID($user_id, $email_template_name, $vars=[])
public verifyActivationRequest($userid, $token, $activate_immediately=true)
public getItemOrCategoryToViewFromFullVirtualFilename($url, $enable_redirect_no_trailingslash_folder=false)
public generatePassword($length=6, $strength)
public getExistingPasswordResetRequestByIDAndHash($id, $hash, $days_difference=1)
public getExistingPasswordResetRequestByUserID($id, $days_difference=1)
public sendPasswordResetRequest($id)
public intcreatePasswordResetRequest(array $user)
Create a password reset request $SystemDB
public restrictFunctionToAuthenticatedUser()
Restrict function to authenticated user only
public restrictFunctionToAnonymousUser()
Restrict function to be available only for anonymous user If the user is logged in, the URL will be forwarded to members welcome page
public setLoginRedirectURL($url)
public getLoginRedirectURL()
public validateEditProfile()
public getItemByVirtualFilename($input_filename, $category_id=-1)
public arraygetItemsByVirtualFilename(string $input_filename, int $category_id=-1)
Returns one or more item with the same virtual filename. Used in later classes. There's a parameter $category_id that's not supposed to be in this class but it's there for compatibility with inherited classes $SystemDB
public getCategoriesByVirtualFilename($input_filename, $parent_id=-1)
public hasAdministrationPermission()
public hasPermission($permission_str)
public hasReadPermission($permission_str)
public hasWritePermission($permission_str)
public hook_modifyDataValuesBeforeSaveItem(\SCHLIX\cmsApplication_List $obj, array $datavalues)
Hook - before save item
public hook_modifyDataValuesBeforeSaveCategory(\SCHLIX\cmsApplication_List $obj, array $datavalues)
Hook - before save item
public getGroupIDArrayForPermission()
public displayAuthenticatedUserMainByApp(string $app_name)
Display welcome page for authenticated users
public getListofFrontendApplicationsWithUserMainPage($from_cache=true, $cache_time_in_minutes=5)
public updateLogHostnames()
public stringgetUserAvatarURLByID(int $id, string $size='small')
Returns a user's avatar URL. Valid size: small, medium, large.
public stringgetUserAvatarURLByExistingUserInfo(array $user, string $size='small')
Returns a user's avatar URL. $he User parmaeter is an array containing user data that has been previously loaded. Valid size: small, medium, large.
public arrayperformAuthentication(string $username, string $password, bool $rememberpassword)
Perform username/password authentication and set user session information. This function returns an array ['status' => (int), 'message' => (array] Use the verifyUserNamePassword method if you don't want to set the session information
public arraygetUserByUserCookies()
Get uid(username)/cvx (session name) from $_cookie, validate it, and return the user $SystemDB
public booleanverifyCurrentSession()
Verify the current user information $SystemDB $SystemLog
public loadDefaultStaticAssetFiles()
Load default JS and CSS required for frontend $HTMLHeader
public viewLoginPage()
View Login page
public viewUserRegistrationPage()
View - new user registration page
public viewPasswordChangePage()
View - Password change page for authenticated user
public viewEditMyProfilePage()
Edit user profile $SystemDB $CurrentUser
public viewPasswordResetPage(string $id, string $hash)
View Password reset page
public booleanviewActivationRequest(string $userid, string $token)
View - user activation
public viewForgotPasswordPage()
View user forgot password page
public viewAuthenticatedUserMainPage()
View - Members welcome page
public viewMainPage()
View - Main page
public arrayajxp_NewRegistration(array $command)
AJAX reply - new user registration
public arrayajxp_UserUpdateProfile(array $command)
AJAX - Update user profile
public arrayajxp_UserLogin(array $command, $custom_redirect_url='')
AJAX - Login
public arrayajxp_UserChangePassword(array $command)
AJAX - change user password
public booleanajxp_UserActivation($command)
View - user activation $HTMLHeader
public ajxp_UserForgotPassword($command)
public arrayajxp_UserForgotPasswordReset($command)
AJAX - reset password for non-authenticated user
public arraygetPersonalDataByUserID(int $user_id)
GDPR - returns an array of personal data by email
public arraygetPersonalDataByEmail($email_address)
GDPR - returns an array of personal data by email
public removePersonalDataByUserID(int $user_id, $request_guid)
GDPR - remove personal data by user ID
public removePersonalDataByEmail($email_address, $request_guid)
GDPR - remove personal data by email
public booleanRun(string $command)
Runs command. If return value is true, then it will be displayed as a full page If return value is false, AJAX method is assumed

Public Static Methods

public static processRunDeleteExpiredSessions()
For CRON TODO - fix for +2.2.0 since there was no date_last_seen and date_created $SystemDB
public static processRunResolveUserHistoryHostnames()
CRON Scheduler Method - resolve hostnames in log cmsLogger $SystemLog