Hello, I have an issue using the `traverse` functi...
# talk-keto
v
Hello, I have an issue using the
traverse
function in my Keto OPL files. Here are the permissions:
Copy code
export class User implements Namespace {}

export class UserList implements Namespace {
	related: {
		members: User[]
		community: Community[]
	}

	permits = {
		view: (ctx: Context): boolean => this.related.community.traverse((c) => c.permits.view(ctx)),
		add_member: (ctx: Context): boolean =>
			this.related.community.traverse((c) => c.related.user_list_managers.includes(ctx.subject)),
		remove_member: (ctx: Context): boolean =>
			this.related.community.traverse((c) => c.related.user_list_managers.includes(ctx.subject)),
	}
}

export class Community implements Namespace {
	related: {
		members: (User | SubjectSet<UserList, "members">)[]
		user_list_managers: (User | SubjectSet<UserList, "members">)[]
	}

	permits = {
		view: (ctx: Context): boolean => this.related.members.includes(ctx.subject),
		create_user_list: (ctx: Context): boolean => this.related.user_list_managers.includes(ctx.subject),
	}
}
My issue is that when using the Ory Network I can make it work and get allowed when intended (checking
add_member
for example) But when I use the self hosted version of Keto and I create exactly the same relations using the API I get “denied” instead of allowed. What am I doing wrong ? Is there an issue with how I use traverse ? Or maybe with how I create relations ? I put my Ory Network relations and my database relations in thread for comparison.
Here are my Ory Network relations
And here are my database values:
Copy code
f809a71d-0daf-4b7f-8a16-7430b2b7bd70	a4016bc5-f5a6-4123-bfef-6f9753afd0d6	UserList	512a2e45-39fc-56cd-a191-cf70e5872bd9	community	ce303a97-30e4-58ae-a6e0-5c3d711b62bf				2023-05-16 11:32:10.478931
77352afa-c930-4b2e-bc55-05bd9ded1983	a4016bc5-f5a6-4123-bfef-6f9753afd0d6	UserList	512a2e45-39fc-56cd-a191-cf70e5872bd9	members	b57102bb-c3df-5d62-ae6e-c5f2eb5c9544				2023-05-16 11:31:56.951067
ab097804-dcc3-471a-8c0e-d5e1f0359193	a4016bc5-f5a6-4123-bfef-6f9753afd0d6	Community	ce303a97-30e4-58ae-a6e0-5c3d711b62bf	user_list_managers		UserList	512a2e45-39fc-56cd-a191-cf70e5872bd9	members	2023-05-16 11:31:24.638526
f2b80112-4a4c-4c8e-a554-cf9470af7734	a4016bc5-f5a6-4123-bfef-6f9753afd0d6	Community	ce303a97-30e4-58ae-a6e0-5c3d711b62bf	members		UserList	512a2e45-39fc-56cd-a191-cf70e5872bd9	members	2023-05-16 11:31:08.199593
Maybe easier to read as a screenshot:
I tried to increase the
max_read_depth
in keto config from 1 to 4 with no success.
s
message has been deleted