Skip to content

Commit

Permalink
fix(keto-cli): make option casing uniform
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Apr 4, 2024
1 parent 434c4ba commit 5483446
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
3 changes: 1 addition & 2 deletions packages/keto-cli/src/app/check-permission.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {
} from '@ory/client';
import { Command, CommandRunner, Option } from 'nest-commander';

interface CommandOptions
extends Pick<Configuration, 'basePath' | 'accessToken'> {
interface CommandOptions extends Pick<Configuration, 'basePath'> {
tuple: PermissionApiCheckPermissionRequest;
}

Expand Down
27 changes: 26 additions & 1 deletion packages/keto-cli/src/app/expand-permissions.command.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('ExpandPermissionsCommand', () => {
});

describe('run', () => {
it('should process tuple and check permission', async () => {
it('should process tuple and expand permission', async () => {
const tuple = {
namespace: 'Group',
object: 'admin',
Expand All @@ -49,6 +49,31 @@ describe('ExpandPermissionsCommand', () => {
oryPermissionsService.expandPermissions = jest.fn().mockResolvedValue({
data: {
type: 'union',
children: [
{
type: 'leaf',
tuple: {
namespace: '',
object: '',
relation: '',
subject_set: {
namespace: 'User',
object: '1',
relation: '',
},
},
},
],
tuple: {
namespace: '',
object: '',
relation: '',
subject_set: {
namespace: 'Group',
object: 'admin',
relation: 'members',
},
},
},
});

Expand Down
2 changes: 1 addition & 1 deletion packages/keto-cli/src/app/expand-permissions.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class ExpandPermissionsCommand extends CommandRunner {
...options,
});
}
const tree = await this.oryPermissionsService.expandPermissions({
const { data: tree } = await this.oryPermissionsService.expandPermissions({
...tuple,
maxDepth: depth,
});
Expand Down
6 changes: 3 additions & 3 deletions packages/keto-cli/src/app/get-relations.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class GetRelationsCommand extends CommandRunner {
}

@Option({
flags: '-sn, --subject-namespace [string]',
flags: '-sn, --subjectNamespace [string]',
description:
'namespace of the subject of the relationship tuple to get relations from',
required: false,
Expand All @@ -127,7 +127,7 @@ export class GetRelationsCommand extends CommandRunner {
}

@Option({
flags: '-so, --subject-object [string]',
flags: '-so, --subjectObject [string]',
description:
'object of the subject of the relationship tuple to get relations from',
required: false,
Expand All @@ -137,7 +137,7 @@ export class GetRelationsCommand extends CommandRunner {
}

@Option({
flags: '-sr, --subject-relation [string]',
flags: '-sr, --subjectRelation [string]',
description:
'relation of the subject of the relationship tuple to get relations from',
required: false,
Expand Down

0 comments on commit 5483446

Please sign in to comment.