„LnxUser::getUser” változatai közötti eltérés

Innen: IT documentation
Nincs szerkesztési összefoglaló
14. sor: 14. sor:
== Return Values ==
== Return Values ==


Returns an '''<code>array</code>''' what contains the information about linux user, or '''<code>false</code>''' if user is not exists.
Returns an 'array' what contains the information about linux user, or 'false' if user is not exists.


Structure of array:
Structure of array:
24. sor: 24. sor:
; 'uid' => int
; 'uid' => int
: User ID of linux user.
: User ID of linux user.
; <code>'gid'</code> => int
; 'gid' => int
: Primary group ID of linux user.
: Primary group ID of linux user.
; <code>'comment'</code> => string
; 'comment' => string
: Comment (display name) of linux user.
: Comment (display name) of linux user.
; <code>'home'</code> => string
; 'home' => string
: Absolute path of Home directory of linux user.
: Absolute path of Home directory of linux user.
; <code>'shell'</code> => string
; 'shell' => string
: Absolute path of shell for linux user.
: Absolute path of shell for linux user.
; <code>'groups'</code> => array
; 'groups' => array
: It is a simple indexed array what contains the groups in what the user is member.  Note: Contains the primary group too!
: It is a simple indexed array what contains the groups in what the user is member.  Note: Contains the primary group too!
; <code>'password'</code> => string
; 'password' => string
: Stored password hash of linux user.
: Stored password hash of linux user.
; <code>'lastchanged'</code> => int
; 'lastchanged' => int
: Date of last password change of linux user. Format: <code>timestamp</code>
: Date of last password change of linux user. Format: timestamp
; <code>'min'</code> => int
; 'min' => int
: The minimum number of days required between password changes
: The minimum number of days required between password changes
; <code>'max'</code> => int
; 'max' => int
: The maximum number of days the password is valid
: The maximum number of days the password is valid
; <code>'warn'</code> => int
; 'warn' => int
: The number of days before password is to expire that user is warned
: The number of days before password is to expire that user is warned
; <code>'inactive'</code> => int
; 'inactive' => int
: The number of days after password expires that account is disabled
: The number of days after password expires that account is disabled
; <code>'expire'</code> => int
; 'expire' => int
: Date when account will be disabled. Format: <code>timestamp</code>
: Date when account will be disabled. Format: timestamp


]
]

A lap 2021. szeptember 19., 15:36-kori változata

Description

Object-oriented style

public lnxUser::getUser ( string | int $user ): array

Procedural style

lnxGetUser ( string | int $user ): array

Returns informations about the linux user.

Parameters

user
Name or User ID of linux user.

Return Values

Returns an 'array' what contains the information about linux user, or 'false' if user is not exists.

Structure of array:

[

'name' => string
Name of linux user.
'uid' => int
User ID of linux user.
'gid' => int
Primary group ID of linux user.
'comment' => string
Comment (display name) of linux user.
'home' => string
Absolute path of Home directory of linux user.
'shell' => string
Absolute path of shell for linux user.
'groups' => array
It is a simple indexed array what contains the groups in what the user is member. Note: Contains the primary group too!
'password' => string
Stored password hash of linux user.
'lastchanged' => int
Date of last password change of linux user. Format: timestamp
'min' => int
The minimum number of days required between password changes
'max' => int
The maximum number of days the password is valid
'warn' => int
The number of days before password is to expire that user is warned
'inactive' => int
The number of days after password expires that account is disabled
'expire' => int
Date when account will be disabled. Format: timestamp

]

Changelog

Version
(lnxUser)
Description
1.00 available

Examples

$user	= 'testUser';

# Query information about the linux user

print( "Information of '$user' user:" . PHP_EOL );

if ( lnxExistsUser( $user ) ) 

	foreach ( lnxGetUser ( $user ) as $key => $value ) {

		print( $key . ' : ' );

		if ( is_array( $value ) ) 

			print( implode ( ',', $value ) );

		else

			print( $value );

		print( PHP_EOL );

	}