How to create users? Not users for the backoffice

#1

hi, is there a way to create users? Not users that would use the backoffice / admin, but users that would register through my frontend.

I would like to create a signup / signin system, where I would then link my uses collection to other collections likes : posts, comments, videos etc.

I saw the auth api but it doesn’t say if I get a token or not… It also doesn’t say if it’s only to create admin users or not.

I don’t want those users to have access to my cockpit admin obviously…

Any idea on how to acheive that?

Just to precise: I am not asking how to create a user collection, I’m asking how to create an auth system that can’t access the admin.

0 Likes

#2

You can use the builtin users functionality and disallow access for user groups to the backend. Managing users can be done via api calls.

The user groups system is simple. Define a group in config/config.yaml

groups:
    user:

Now you have a user group named “user” without any rights. Everything is set to false unless you enable it.

Send a request /api/cockpit/saveUser?token=xxtokenxx

{"user":{"name":"API User Test","user":"apiusertest","password":"apiusertest","email":"post@example.com","api_key":1}}

If you don’t set "api_key" to anything, no api key is created.

Have a look here to see the defaults:

0 Likes

#3

okay i’ll give it a try.
It’s not pretty clear in the docs though on how groups are handles.
By default are collections tied to the admin group or are public on creation, edit and delete ?

0 Likes

#4

Collections aren’t public, but you can enable permissions via groups settings (config file) or in the collection definitions (admin ui when editing collection, tab “Permissions”) with rights per collection.

0 Likes