This commit is contained in:
Jacob Zaval 2022-03-04 20:00:29 -08:00
Родитель 2aa0c1f17a
Коммит e65ec101da
1 изменённых файлов: 24 добавлений и 14 удалений

Просмотреть файл

@ -1,12 +1,10 @@
macos_user
=========
# macos_user
Use the **macos_user** resource to manage user creation.
Under the hood, the [**macos_user**](https://github.com/Microsoft/macos-cookbook/blob/master/resources/macos_user.rb) resource executes the `sysadminctl`
command.
Syntax
------
## Syntax
The full syntax for all of the properties available to the **macos_user** resource
is:
@ -20,10 +18,14 @@ macos_user 'user and action description' do
hidden TrueClass # hidden status of user
fullname String # full name of user
groups Array, String # list of groups the user is in
end
secure_token TrueClass # secure token status of user
existing_token_auth Hash # the username and password of an existing secure token user
end
```
The following example is equivalent to issuing ```"sysadminctl -addUser jlevinson -password serenity -admin"```
Whenever modifying or creating a secure token user, the `existing_token_auth` property must be provided a Hash in the format of: `{ username: 'username', password: 'password' }`. This should not be the user being modified or created, but an existing user on the system who has a secure token, or the owner account of the system.
The following example is equivalent to issuing `"sysadminctl -addUser jlevinson -password serenity -admin"`
```ruby
macos_user 'create admin user' do
@ -33,24 +35,19 @@ macos_user 'create admin user' do
end
```
Actions
-------
## Actions
`:create`
      Create a user specified by
`macos_user` properties. This is the default action.
`macos_user` properties. If the user already exists, the secure token status will be updated to match.
`:delete`
      Delete a user specified by
the `macos_user` username property.
Examples
--------
## Examples
**Create a user with admin privileges**
@ -83,3 +80,16 @@ macos_user 'create user' do
groups ['accounting']
end
```
**Create a user that has a secure token**
```ruby
macos_user 'create user' do
username 'stanley'
fullname 'Stanley Hudson'
password 'florida'
groups ['sales']
secure_token true
existing_token_auth { username: 'robert', password: 'lizard' }
end
```