@@ -17,16 +17,16 @@ class RoleApiController extends ApiController
1717
1818 protected $ rules = [
1919 'create ' => [
20- 'display_name ' => ['required ' , 'min:3 ' , 'max:180 ' ],
21- 'description ' => ['max:180 ' ],
20+ 'display_name ' => ['required ' , 'string ' , ' min:3 ' , 'max:180 ' ],
21+ 'description ' => ['string ' , ' max:180 ' ],
2222 'mfa_enforced ' => ['boolean ' ],
2323 'external_auth_id ' => ['string ' ],
2424 'permissions ' => ['array ' ],
2525 'permissions.* ' => ['string ' ],
2626 ],
2727 'update ' => [
28- 'display_name ' => ['min:3 ' , 'max:180 ' ],
29- 'description ' => ['max:180 ' ],
28+ 'display_name ' => ['string ' , ' min:3 ' , 'max:180 ' ],
29+ 'description ' => ['string ' , ' max:180 ' ],
3030 'mfa_enforced ' => ['boolean ' ],
3131 'external_auth_id ' => ['string ' ],
3232 'permissions ' => ['array ' ],
@@ -64,6 +64,7 @@ public function list()
6464
6565 /**
6666 * Create a new role in the system.
67+ * Permissions should be provided as an array of permission name strings.
6768 * Requires permission to manage roles.
6869 */
6970 public function create (Request $ request )
@@ -81,7 +82,8 @@ public function create(Request $request)
8182 }
8283
8384 /**
84- * View the details of a single user.
85+ * View the details of a single role.
86+ * Provides the permissions and a high-level list of the users assigned.
8587 * Requires permission to manage roles.
8688 */
8789 public function read (string $ id )
@@ -94,6 +96,10 @@ public function read(string $id)
9496
9597 /**
9698 * Update an existing role in the system.
99+ * Permissions should be provided as an array of permission name strings.
100+ * An empty "permissions" array would clear granted permissions.
101+ * In many cases, where permissions are changed, you'll want to fetch the existing
102+ * permissions and then modify before providing in your update request.
97103 * Requires permission to manage roles.
98104 */
99105 public function update (Request $ request , string $ id )
@@ -107,9 +113,7 @@ public function update(Request $request, string $id)
107113 }
108114
109115 /**
110- * Delete a user from the system.
111- * Can optionally accept a user id via `migrate_ownership_id` to indicate
112- * who should be the new owner of their related content.
116+ * Delete a role from the system.
113117 * Requires permission to manage roles.
114118 */
115119 public function delete (string $ id )
0 commit comments