summaryrefslogtreecommitdiff
path: root/lib/chef/provider/user
Commit message (Collapse)AuthorAgeFilesLines
* Remove copyright dateslcg/remove-copyright-datesLamont Granquist2020-04-136-6/+6
| | | | | | | | Legally incredibly dubious, particularly since we don't follow it strictly as policy, and we have git history instead, which does it right. This is just a waste of time and a cargo cult. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Use the correct plist class in the mac user providerTim Smith2020-04-131-2/+2
| | | | | | This is actually a subclass of the mac user provider and not the Plist gem. This is a super confusing name btw. Plist passed Plist, but it's a different Plist. Signed-off-by: Tim Smith <tsmith@chef.io>
* Make sure we're always using the right Plist classTim Smith2020-04-102-5/+5
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Require plist where we use itTim Smith2020-04-101-0/+1
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Revert someVivek Singh2020-04-061-1/+1
| | | | Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
* Fix typoVivek Singh2020-04-062-2/+2
| | | | Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
* convert move resources to unified_modelcg/unified-mode3Lamont Granquist2020-02-252-11/+11
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Account for if the propery is not being set in the resource, and also if it ↵Joseph Chilcote2020-01-251-1/+4
| | | | | | doesn't exist in the user record Signed-off-by: Joseph Chilcote <chilcote@fb.com>
* Adding support for IsHidden user attribute (macOS)Joseph Chilcote2020-01-251-1/+29
| | | | Signed-off-by: Joseph Chilcote <chilcote@fb.com>
* editing one more line outJoseph Chilcote2020-01-241-2/+0
| | | | Signed-off-by: Joseph Chilcote <chilcote@fb.com>
* Fixes #9171Joseph Chilcote2020-01-241-7/+22
| | | | | | | mac_user will now use the numeric GID when creating a user, and adds support for `system true` Signed-off-by: Joseph Chilcote <chilcote@fb.com>
* Clear password flags when setting the passwordAron List2020-01-131-1/+1
| | | | | This will clear the password flags when the password is set for this user. This ensures that the user will not be prompted to change their password on next login. Signed-off-by: Aron List <aronotmar@live.nl>
* Fix mac_user breakage and loggingLamont Granquist2019-12-121-22/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | We need more defensive coding around the absense of the ShadowData. Unfortunately I wasn't able to fix the tests on my mac where this happens, and don't know how to introduce tests that would fail on buildkite, so we have no coverage for this. Testing was done manually on the CLI. Also removed some useless converge_by statements that were effectively double-logging. The methods that the converge_by's were in are already wrapped by converge_by's in the superclass so the resource is already "dirty" in the sense that it knows that it is being updated, and the log message that e.g. the user is being removed is already being printed. Some of the sub-action logging with sub-converge_by's here is still good since it shows the details of how the user is being added or removed or modified which makes sense (still sort of abusing converge_by to get only logging, but that doesn't matter because we're in a block where we MUST be updating the resource anyway). This commit also re-adds testing of unit+integration testing to the omnibus pipeline. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Removed method for defining return codes, changed to evaluate stderr on exit ↵skippy2019-11-191-15/+10
| | | | | | code 12 Signed-off-by: Jonathan Jones <gitmaster@thespooky.house>
* Replaced 'test' shellout with `Dir.exist?`skippy2019-11-181-4/+1
| | | | Signed-off-by: Jonathan Jones <gitmaster@thespooky.house>
* Resolved all chefstyle failuresskippy2019-11-171-1/+1
| | | | Signed-off-by: Jonathan Jones <gitmaster@thespooky.house>
* re-un-inverted my previous 3am coding adventure in double negativesskippy2019-11-171-1/+1
| | | | Signed-off-by: Jonathan Jones <gitmaster@thespooky.house>
* Resolved failing tests, fixed inverted logicskippy2019-11-171-4/+4
| | | | Signed-off-by: Jonathan Jones <gitmaster@thespooky.house>
* Resolved issues with tests not receiving exactly what they expected.skippy2019-11-171-1/+1
| | | | | | Resolved new method in linux_user not returning the correct array. Signed-off-by: Jonathan Jones <gitmaster@thespooky.house>
* Fixed my bad typing and misplaced colons.skippy2019-11-171-1/+1
| | | | Signed-off-by: Jonathan Jones <gitmaster@thespooky.house>
* Modifed linux_user resource to add an additional 'returns' field to each ↵skippy2019-11-171-5/+18
| | | | | | | | | action method s hell_out reference. This fixes an issue related to certain commands returning non-0 exit codes but still functioning as exptected Signed-off-by: Jonathan Jones <gitmaster@thespooky.house>
* [macos] fix mac_user platform constraintsryan/fix-macos-buildRyan Cragun2019-09-101-20/+20
| | | | Signed-off-by: Ryan Cragun <ryan@chef.io>
* add functional testryancragun/mac_userRyan Cragun2019-09-031-4/+4
| | | | Signed-off-by: Ryan Cragun <ryan@chef.io>
* Wrap all shell_out's that change the system in converge_byRyan Cragun2019-08-081-27/+26
| | | | Signed-off-by: Ryan Cragun <ryan@chef.io>
* Make user and admin group plists first classRyan Cragun2019-07-291-111/+121
| | | | Signed-off-by: Ryan Cragun <ryan@chef.io>
* remove validation that is now in the resourceRyan Cragun2019-07-291-11/+0
| | | | Signed-off-by: Ryan Cragun <ryan@chef.io>
* Address review feedback round 1Ryan Cragun2019-07-261-96/+119
| | | | | | | | | | | | | | | | | * Fix 'iterations' description * Update 'gid' property, remove coercion, resolve group name and id in provider * Move validation of password value when given salt to resource property coercion * Restructure exception handling around calls * Don't re-map properties onto current_resource after load_current_resource * Execute inline group resources with run_action * Always set the home directory when creating a user * Poll for user creating instead of a hard sleep * Remove old ascii encoding copy pasta Signed-off-by: Ryan Cragun <ryan@chef.io>
* Add mac_user resource that is compatible with macOS >= 10.14Ryan Cragun2019-07-242-2/+609
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide a user resource that is compatible with default TCC restrictions that were introduced in macOS 10.14. Changes: * This resource and the corresponding provider have been modified to work with default macOS TCC policies. Direct access to user binary plists are no longer permitted by default, thus we've chosen to use use newer methods of creating, modifying and removing users. * Due to the tooling required by the provider this provider is only suitable for use on macOS >= 10.14. Support for older platforms has been removed. New Features: * Primary group management is now included. * 'admin' is now a boolean property that configures a user to an admin. * 'admin_username' and 'admin_password' are new properties that define the admin user credentials required for toggling SecureToken for an exiting user. The 'admin_username' must correspond to a system admin with SecureToken enabled in order to toggle SecureToken. * 'secure_token' is a boolean property that sets the desired state for SecureToken. SecureToken token is required for FileVault full disk encryption. Signed-off-by: Ryan Cragun <ryan@chef.io>
* Style/StringLiteralsInInterpolationLamont Granquist2019-07-051-1/+1
| | | | | | since we use double quotes, be consistent everywhere. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/RegexpLiteralLamont Granquist2019-07-051-1/+1
| | | | | | | given how many regexps we have with /'s in the match this seems like a very good one. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/SymbolArrayLamont Granquist2019-07-021-1/+1
| | | | | | start enforcing using %i{} instead of arrays of symbols Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Layout/EmptyLineAfterGuardClauseLamont Granquist2019-07-026-0/+13
| | | | | | | i like this one, gives visual priority to returns or raises that are buried in the middle of things. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Layout/AlignArgumentslcg/new-chefstyleLamont Granquist2019-07-021-1/+1
| | | | | | | | | | | | | | this is using: Layout/AlignArguments: Enabled: true EnforcedStyle: with_fixed_indentation the default style can use really excessive whitespace. on starting lines which are already long, it fully indents across to where the arguments start and then begins the line there. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* This hits the ones that are most frequently required.lcg/require-idempotencyLamont Granquist2019-05-201-1/+1
| | | | | | | | | Stops the kernel from scanning through all the activated gems every time in order to resolve names into pathnames. See rubygems/rubygems#2762 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Change some more require to require_relativeLamont Granquist2019-05-101-1/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix a bunch of weirdly mangled require linesLamont Granquist2019-05-086-6/+6
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Convert require to require_relativeLamont Granquist2019-05-086-10/+10
| | | | | | | This gives a speed boost since rubygems does not have to scan through every gem in the gemset in order to find the file. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Load the correct resource in dscl provideruser_cleanupTim Smith2019-02-191-1/+2
| | | | | | This worked until I moved the interations property into the dscl_user resource directly. Signed-off-by: Tim Smith <tsmith@chef.io>
* Remove the legacy useradd user providerTim Smith2019-02-191-161/+0
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Add another description and simplify the windows checkTim Smith2019-02-191-4/+2
| | | | | | More cleanup Signed-off-by: Tim Smith <tsmith@chef.io>
* user resource: Remove support for macOS 10.7 and 10.7 upgraded to 10.8+Tim Smith2019-01-141-117/+36
| | | | | | We can greatly simplify our dscl user provider by removing support for macOS 10.7 and 10.7 which has been upgraded to 10.8. No one is using this anyone as it's beyond EOL with Apple and has been for years. Signed-off-by: Tim Smith <tsmith@chef.io>
* MSYS-888 Adds full_name property to user resource for Windows.vasu11052018-09-241-3/+4
| | | | Signed-off-by: vasu1105 <vasundhara.jagdale@msystechnologies.com>
* Fix issue of setting comment for windows userNAshwini2018-08-101-2/+2
| | | | Signed-off-by: NAshwini <ashwini.nehate@msystechnologies.com>
* Remove require mixlib/shellouts where not necessaryrequire_the_right_shelloutTim Smith2018-07-101-1/+1
| | | | | | the dscl user provider uses mixin/shell_out instead and the specs don't seem to use mixlib/shellout or actually need the require. Signed-off-by: Tim Smith <tsmith@chef.io>
* fix Style/MutableConstantLamont Granquist2018-07-021-1/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Style/UnneededInterpolationLamont Granquist2018-07-021-1/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Unification of shell_out APIsLamont Granquist2018-06-156-35/+35
| | | | | | | converts all usage to just shell_out() from the numerous helper utilities that we've had previously. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Merge pull request #7249 from chef/lcg/cleanup-userLamont Granquist2018-05-215-53/+105
|\ | | | | Cleanup AIX and Solaris user resources.
| * clean up updating_home?lcg/cleanup-userLamont Granquist2018-05-103-22/+0
| | | | | | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
| * bonus fix to remove unnecessary duping in dscl userLamont Granquist2018-05-101-7/+3
| | | | | | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>