Horizon user management

If you are using Horizon's Authentication system and not any third party authentication, such as Facebook, Twitter, and so on, user information is stored in a special Horizon collection called users.

You can use the user's collection either by loading it similarly to other collections, or access it directly as shown in the following code:

const horizon = Horizon();
// Access as a standard collection
const users = horizon('users'); 
// Access through the shortcut
const users = horizon.users; 

Note

Note: Third-party authentication is not in the scope of this chapter, however you can learn about it here http://horizon.io/docs/auth/.

When a new user is created, Horizon assigns it two user groups, which are:

  • Default: Rules for all the users
  • Authenticated: Rules for those users who are authenticated by the system

These user groups are used to assign permission to the user. A typical document in the users collections looks like this:

{
     "id": "D6B8E9D0-CD96-4C01-BFD6-2AF43141F2A7",
     "groups": [ "default", "authenticated" ]
}  

You can make changes to the document in the users collection, but not to the collection itself. No user is allowed to perform any change in the collection.

This covers the user's authentication in Horizon. To learn more about the permission system, please visit the official link http://horizon.io/docs/permissions/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.4.174