Skip to content

Commit 6f1ced0

Browse files
authored
Merge pull request #378 from josephschorr/fix-bulk
Fixes for bulk check command
2 parents 9038fb5 + 211d3d9 commit 6f1ced0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

internal/commands/permission.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,10 @@ var permissionCmd = &cobra.Command{
117117
}
118118

119119
var checkBulkCmd = &cobra.Command{
120-
Use: "bulk <resource:id> <permission> <subject:id>",
121-
Short: "Check a permissions in bulk exists for a resource-subject pairs",
122-
Args: cobra.MinimumNArgs(2),
123-
ValidArgsFunction: GetArgs(ResourceID, Permission, SubjectID),
124-
RunE: checkBulkCmdFunc,
120+
Use: "bulk <resource:id#permission@subject:id> <resource:id#permission@subject:id> ...",
121+
Short: "Check a permissions in bulk exists for a resource-subject pairs",
122+
Args: cobra.MinimumNArgs(1),
123+
RunE: checkBulkCmdFunc,
125124
}
126125

127126
var checkCmd = &cobra.Command{
@@ -277,6 +276,10 @@ func checkBulkCmdFunc(cmd *cobra.Command, args []string) error {
277276
items := make([]*v1.CheckBulkPermissionsRequestItem, 0, len(args))
278277
for _, arg := range args {
279278
rel := tuple.ParseRel(arg)
279+
if rel == nil {
280+
return fmt.Errorf("unable to parse relation: %s", arg)
281+
}
282+
280283
item := &v1.CheckBulkPermissionsRequestItem{
281284
Resource: &v1.ObjectReference{
282285
ObjectType: rel.Resource.ObjectType,

0 commit comments

Comments
 (0)