File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,15 @@ $permissions = TeamPermissions::fromFlags(
190
190
);
191
191
```
192
192
193
+ Or from the permissions of an existing team:
194
+
195
+ ``` php
196
+ use PrivatePackagist\ApiClient\TeamPermissions;
197
+
198
+ $team = $client->teams()->all()[0];
199
+ $permissions = TeamPermissions::fromTeamResponse($team);
200
+ ```
201
+
193
202
#### List an organization's teams
194
203
``` php
195
204
$teams = $client->teams()->all();
Original file line number Diff line number Diff line change @@ -38,4 +38,15 @@ public static function fromFlags(int $flags): self
38
38
$ permissions ->canManageVendorCustomers = ($ flags & self ::PERMISSION_CAN_MANAGE_VENDOR_CUSTOMERS ) > 0 ;
39
39
return $ permissions ;
40
40
}
41
+
42
+ public static function fromTeamResponse (array $ team ): self
43
+ {
44
+ $ permissions = new self ;
45
+ $ permissions ->canEditTeamPackages = isset ($ team ['permissions ' ]['canEditTeamPackages ' ]) && $ team ['permissions ' ]['canEditTeamPackages ' ];
46
+ $ permissions ->canAddPackages = isset ($ team ['permissions ' ]['canAddPackages ' ]) && $ team ['permissions ' ]['canAddPackages ' ];
47
+ $ permissions ->canCreateSubrepositories = isset ($ team ['permissions ' ]['canCreateSubrepositories ' ]) && $ team ['permissions ' ]['canCreateSubrepositories ' ];
48
+ $ permissions ->canViewVendorCustomers = isset ($ team ['permissions ' ]['canViewVendorCustomers ' ]) && $ team ['permissions ' ]['canViewVendorCustomers ' ];
49
+ $ permissions ->canManageVendorCustomers = isset ($ team ['permissions ' ]['canManageVendorCustomers ' ]) && $ team ['permissions ' ]['canManageVendorCustomers ' ];
50
+ return $ permissions ;
51
+ }
41
52
}
You can’t perform that action at this time.
0 commit comments