In the user table when I am trying to assign a role to a user, it is showing public and authenticated options only. How to select ‘author’/‘editor’ or any other to the user through the admin panel and also through API?
First of all, you need to understand that the Editor
, Author
& Super Admin
are roles for admin panel users only. So basically, it will only control/limit what the user can do after logging in into the admin panel (http://localhost:1337/admin
). Additionally, these roles can only be assigned to the admin panel users which can be created by visiting the following module:
http://localhost:1337/admin/settings/users
.
Now coming to your question, as to why we can't assign Editor
/Author
to users in the users collection, it's because the roles assigned to these users are in a separate module:
http://localhost:1337/admin/settings/users-permissions/roles
The roles created in this module are basically assigned to API
consumers. So you could create roles of your own choice in this module and then:
API
s this role can accesspublic
or private
to this rolerate limiting
Once you create the roles of your choice in this module, then you can go to users
collection module.
http://localhost:1337/admin/plugins/content-manager/collectionType/plugins::users-permissions.user?page=1&pageSize=10&_sort=username:ASC
You could then create users (API
consumers/users) who will have their own set of credentials (email & password) which can then be used for acquiring the bearer token.
API
s with that token. Simple!P.S:
Bearer Token
is used on the headers for accessing private routes enabled for that particular user role.