„LnxUser::addGroup” változatai közötti eltérés
Innen: IT documentation
(Új oldal, tartalma: „== Description == Object-oriented style<syntaxhighlight lang="php"> </syntaxhighlight>Procedural style<syntaxhighlight lang="php"> </syntaxhighlight> == Parameters…”) |
|||
| (3 közbenső módosítás ugyanattól a szerkesztőtől nincs mutatva) | |||
| 1. sor: | 1. sor: | ||
== Description == | == Description == | ||
Object-oriented style<syntaxhighlight lang="php"> | Object-oriented style<syntaxhighlight lang="php"> | ||
public lnxUser::addGroup ( array $group ): bool | |||
</syntaxhighlight>Procedural style<syntaxhighlight lang="php"> | </syntaxhighlight>Procedural style<syntaxhighlight lang="php"> | ||
lnxAddGroup ( array $group ): bool | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Create a linux group with '''group''' parameters | |||
== Parameters == | == Parameters == | ||
; group | |||
: Associative array what contains the new group's parameters. | |||
: THe structure of the array: | |||
: [ | |||
:; 'name' => string | |||
:: Mantandory! Name of linux group. | |||
:; 'gid' => int | |||
:: Optional. Group ID of linux group. The ID must not exist! | |||
:; 'system' => bool | |||
:: Optional. If '''true''' create a system group. Group ID will be under 1000. If 'gid' is present this parameter will be ineffective. | |||
:; 'nonunique' => bool | |||
:: Optional. If '''true''' allow to create groups with duplicate (non-unique) Group ID | |||
: ] | |||
== Return Values == | == Return Values == | ||
Returns '''true''' if group is created, '''false''' otherwise. | |||
== Changelog == | == Changelog == | ||
{| class="wikitable" | {| class="wikitable" | ||
| 24. sor: | 37. sor: | ||
== Examples == | == Examples == | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
$group = 'testGroup'; | $group = 'testGroup'; | ||
# Add linux group | |||
if ( ! lnxAddGroup( [ | |||
'name' => $group, // Mantandory! Name of linux group. | |||
//'gid' => 1011, // Optional. Group ID of linux group. The ID must not exist! | |||
//'system' => true, // Optional. If true create a system group. Group ID will be under 1000. If 'gid' is present this parameter will be ineffective. | |||
//'nonunique' => true, // Optional. If true allow to create groups with duplicate (non-unique) Group ID | |||
] ) ) | |||
print( "Something went wrong during Add group!" . PHP_EOL ); | |||
else | |||
print( "'$group' group is created." . PHP_EOL ); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Kategória:LnxUser]] | [[Kategória:LnxUser]] | ||
A lap jelenlegi, 2021. szeptember 19., 15:55-kori változata
Description
Object-oriented style
public lnxUser::addGroup ( array $group ): bool
Procedural style
lnxAddGroup ( array $group ): bool
Create a linux group with group parameters
Parameters
- group
- Associative array what contains the new group's parameters.
- THe structure of the array:
- [
- 'name' => string
- Mantandory! Name of linux group.
- 'gid' => int
- Optional. Group ID of linux group. The ID must not exist!
- 'system' => bool
- Optional. If true create a system group. Group ID will be under 1000. If 'gid' is present this parameter will be ineffective.
- 'nonunique' => bool
- Optional. If true allow to create groups with duplicate (non-unique) Group ID
- ]
Return Values
Returns true if group is created, false otherwise.
Changelog
| Version (lnxUser) |
Description |
|---|---|
| 1.00 | available |
Examples
$group = 'testGroup';
# Add linux group
if ( ! lnxAddGroup( [
'name' => $group, // Mantandory! Name of linux group.
//'gid' => 1011, // Optional. Group ID of linux group. The ID must not exist!
//'system' => true, // Optional. If true create a system group. Group ID will be under 1000. If 'gid' is present this parameter will be ineffective.
//'nonunique' => true, // Optional. If true allow to create groups with duplicate (non-unique) Group ID
] ) )
print( "Something went wrong during Add group!" . PHP_EOL );
else
print( "'$group' group is created." . PHP_EOL );