Hello @Matteo ,
Sorry for the late response we were in an event last week and your ticket has been lost in the way…
It reminds me this thread about dissociate… and the fact that not easy to setup this…
Hi Forest.
Any update about this from your product board?
Is this covered in the new @forestadmin/agent?
Thank you,
Matteo
@morganperre I’m tagging you here because you liked the previous answer and the Forest Guy who answered me in march 2023 is now “anon###” so maybe at the moment he’s not a Forest Guy any more
Matteo:
It looks like there’s some permission problem, because in our logs we see that the backend is returning a http 403
error to Forest (as we can see with the Chrome dev tools):
With the new agent, we had some struggle about this… and finally we found out that we could make this work by adding the DELETE permission to the role for the collections ExperienceTemplate
and Idea
. But we absolutely don’t want to allow the delete of these items! And we’re quite sure that the disassociate operation has nothing to do with the record deletion.
You are absolutely right. I just check our code and the agent check that the user can delete to allow dissociate. But as we saw this is wrong since dissociating can only be an update …
export default class DissociateDeleteRelatedRoute extends RelationRoute {
setupRoutes(router: Router): void {
router.delete(
`/${this.collectionUrlSlug}/:parentId/relationships/${this.relationUrlSlug}`,
this.handleDissociateDeleteRelatedRoute.bind(this),
);
}
public async handleDissociateDeleteRelatedRoute(context: Context): Promise<void> {
await this.services.authorization.assertCanDelete(context, this.collection.name);
// Parse route params
const parentId = IdUtils.unpackId(this.collection.schema, context.params.parentId);
const isDeleteMode = Boolean(context.request.query?.delete);
const caller = QueryStringParser.parseCaller(context);
const filter = await this.getBaseForeignFilter(context);
// Dissociating a one to many or many many is quite a different job => delegate
const relation = SchemaUtils.getToManyRelation(this.collection.schema, this.relationName);
I will circle back with our teams to find a clean solution. I will come back to you when we decide something.
Matteo:
With the new agent, we couldn’t exclude this model, because we understood that it’s needed to fulfil all the paths between model relationships on Forest side. So we didn’t exclude it. And we just hid the collection from the collection list in the main forest dashboard.
I imagine you tried the excludes collection option of addDataSource am I right ?
Read-only
settings has you show is only a frontend layout customization (it only affects the frontend state).
Again, I will circle back we our team to solve the dissociate issue.
Kind regards,
Morgan