How to not allow an end user to update/delete another end user's post?

Hi 5ika,

Thanks for the reply. I’m having a hard time implementing what’s in the docs. Here’s my src file structure:

src
├── admin
│   ├── app.example.tsx
│   ├── tsconfig.json
│   └── webpack.config.example.ts
├── api
│   └── post
│       ├── content-types
│       │   └── post
│       │       └── schema.json
│       ├── controllers
│       │   └── post.ts
│       ├── policies
│       │   └── user-post-policy.ts
│       ├── routes
│       │   ├── post.ts
│       │   └── router.ts
│       └── services
│           └── post.ts
├── extensions
│   └── users-permissions
│       └── content-types
│           └── user
│               └── schema.json
└── index.ts

and here’s my user post policy file; I wanted to try logging the objects first to get an idea of what they are because I couldn’t find anything more about them in the Policies docs.

export default (policyContext: any, config: any, { strapi }) => {
    console.log('policyContext: ', policyContext);
    console.log('config: ', config);
    console.log('strapi: ', strapi);
};

here’s also my router.ts file

export default {
    routes: [
        {
            method: 'DELETE',
            path: '/posts',
            handler: 'post.delete',
            config: {
                policies: ['user-post-policy']
            }
        },
        {
            method: 'PUT',
            path: '/posts',
            handler: 'post.update',
            config: {
                policies: ['user-post-policy']
            }
        }
    ]
}

Nothing logged onto the terminal when I deleted a post, it deleted but it seems like it didn’t “pass through” the custom policy I made. Thanks again in advance for a reply or answer :slight_smile: