1: <?php
2:
3: namespace Cloudflare\Organizations;
4:
5: use Cloudflare\Api;
6: use Cloudflare\Organizations;
7:
8: /**
9: * CloudFlare API wrapper
10: *
11: * Organization Members
12: *
13: * @author James Bell <[email protected]>
14: *
15: * @version 1
16: */
17: class Members extends Api
18: {
19: /**
20: * Default permissions level
21: *
22: * @var array
23: */
24: protected $permission_level = ['read' => '#organization:read', 'edit' => '#organization:edit'];
25:
26: /**
27: * List members (permission needed: #organization:read)
28: * List all members of a organization
29: *
30: * @param string $organization_identifier
31: */
32: public function members($organization_identifier)
33: {
34: return $this->get('/organizations/'.$organization_identifier.'/members');
35: }
36:
37: /**
38: * Member details (permission needed: #organization:read)
39: * Get information about a specific member of an organization
40: *
41: * @param string $organization_identifier
42: * @param string $identifier
43: */
44: public function details($organization_identifier, $identifier)
45: {
46: return $this->get('/organizations/'.$organization_identifier.'/members/'.$identifier);
47: }
48:
49: /**
50: * Update member roles (permission needed: #organization:edit)
51: * Change the Roles of an Organization's Member
52: *
53: * @param string $organization_identifier
54: * @param string $identifier
55: * @param array|null $roles Array of Roles associated with this Member
56: */
57: public function update($organization_identifier, $identifier, array $roles = null)
58: {
59: $data = [
60: 'roles' => $roles,
61: ];
62:
63: return $this->patch('/organizations/'.$organization_identifier.'/members/'.$identifier, $data);
64: }
65:
66: /**
67: * Remove member (permission needed: #organization:edit)
68: * Remove a member from an organization
69: *
70: * @param string $organization_identifier
71: * @param string $identifier
72: */
73: public function delete_member($organization_identifier, $identifier)
74: {
75: return $this->delete('/organizations/'.$organization_identifier.'/members/'.$identifier);
76: }
77: }
78: