Puppet Class: wp::user

Defined in:
manifests/user.pp

Overview

A class for WP-CLI’s user commands.

Parameters:

  • location (Any)
  • args (Any)
  • ensure (Any) (defaults to: present)
  • user (Any) (defaults to: $::wp::user)
  • onlyif (Any) (defaults to: "${wp::params::bin_path}/wp core is-installed")


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'manifests/user.pp', line 2

class wp::user (
  $location,
  $args,
  $ensure = present,
  $user   = $::wp::user,
  $onlyif = "${wp::params::bin_path}/wp core is-installed",
) {
  include wp::cli

  case $ensure {
    present: {
      $command = "create ${args}"
    }
    absent: {
      $command = "delete ${args}"
    }
    equal: {
      $command = "update ${args}"
    }
    generate: {
      $command = "generate ${args}"
    }
    add-role: {
      $command = "add-role ${args}"
    }
    set-role: {
      $command = "set-role ${args}"
    }
    remove-role: {
      $command = "remove-role ${args}"
    }
    add-cap: {
      $command = "add-cap ${args}"
    }
    remove-cap: {
      $command = "remove-cap ${args}"
    }
    meta: {
      $command = "meta ${args}"
    }
    term: {
      $command = "term ${args}"
    }
    import: {
      $command = "import-csv ${args}"
    }
    default: {
      fail( 'Invalid attribute for wp::user' )
    }
  }
  wp::command { "${location} user ${command}":
    location => $location,
    command  => "user ${command}",
    user     => $user,
    onlyif   => $onlyif,
  }
}