„LnxUser::getUser” változatai közötti eltérés
Innen: IT documentation
Nincs szerkesztési összefoglaló |
Nincs szerkesztési összefoglaló |
||
| 1. sor: | 1. sor: | ||
== Description == | == Description == | ||
Object-oriented style<syntaxhighlight lang="php"> | Object-oriented style<syntaxhighlight lang="php"> | ||
public lnxUser::getUser ( string | int $user ): array | |||
</syntaxhighlight>Procedural style<syntaxhighlight lang="php"> | </syntaxhighlight>Procedural style<syntaxhighlight lang="php"> | ||
lnxGetUser ( string | int $user ): array | |||
</syntaxhighlight> | </syntaxhighlight>Returns informations about the linux user. | ||
== Parameters == | == Parameters == | ||
; user | |||
: Name or User ID of linux user. | |||
: | |||
== 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. | |||
Structure of array: | |||
[ | |||
; 'name' => string | |||
: Name of linux user. | |||
; 'uid' => int | |||
: User ID of linux user. | |||
; <code>'gid'</code> => int | |||
: Primary group ID of linux user. | |||
; <code>'comment'</code> => string | |||
: Comment (display name) of linux user. | |||
; <code>'home'</code> => string | |||
: Absolute path of Home directory of linux user. | |||
; <code>'shell'</code> => string | |||
: Absolute path of shell for linux user. | |||
; <code>'groups'</code> => array | |||
: 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 | |||
: Stored password hash of linux user. | |||
; <code>'lastchanged'</code> => int | |||
: Date of last password change of linux user. Format: <code>timestamp</code> | |||
; <code>'min'</code> => int | |||
: The minimum number of days required between password changes | |||
; <code>'max'</code> => int | |||
: The maximum number of days the password is valid | |||
; <code>'warn'</code> => int | |||
: The number of days before password is to expire that user is warned | |||
; <code>'inactive'</code> => int | |||
: The number of days after password expires that account is disabled | |||
; <code>'expire'</code> => int | |||
: Date when account will be disabled. Format: <code>timestamp</code> | |||
] | |||
== Changelog == | == Changelog == | ||
| 24. sor: | 63. sor: | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
$user = 'testUser'; | $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 ); | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Kategória:LnxUser]] | [[Kategória:LnxUser]] | ||
A lap 2021. szeptember 19., 15:34-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 );
}