Logo Decentralized Social Network

Access Controls

Node API allows defining who has access to the content of the node — postings, comments, reactions, media files etc. Each one of these objects has a set of operations like view, edit, delete and so on, and every operation is assigned a principal. The principal is a string that defines which client or a group of clients has permission to perform the operation.

Operations are returned together with the content of the object from the corresponding API calls. To save traffic, only operations that have non-default values are returned. To update the operations, use the same API calls that create or update the object.

Read also the overview of the permission architecture in Moera.

Hierarchy of Objects

Objects are organized into hierarchy, as follows:

  • Node
    • Node name
    • Profile
    • Feed
    • Story
    • Posting
      • Comment
        • Reaction
      • Reaction
    • Media file
    • Draft
    • People info
    • Contact
    • Subscriber
    • Subscription
    • Friend group

Every object has its own set of operations. But in many cases, several operations need to be permitted to perform a particular request. For example, to add a negative reaction to a posting, the client needs to have access to both addReaction and addNegativeReaction operations. To view a comment the client needs both view on the comment itself and viewComments on the posting.

Objects on higher levels may override permissions of the objects on lower levels. For example, comment’s author may disable negative reactions to his comment by setting addNegativeReaction operation to none. But the posting’s author may override this permission to force all comments to the posting to accept negative reactions.

Principals

Simple Principals

Simple principals allow the operation to the object’s owner and owners of higher-level objects (node admin is the owner of the node). The following tables describe how simple principals are defined for objects on different levels of the hierarchy.

The rightmost column in the table is the principal. Other columns correspond to the owner of the object and owners of higher-level objects in the hierarchy.

+ — the access is allowed
— the access is not allowed

Level 1

node owner object owner  
+ + private
+ + secret
+ + enigma
+ senior
+ major
+ admin
+ owner
none

Level 2

node owner posting owner object owner  
+ + + private
+ + secret
+ + enigma
+ + senior
+ major
+ admin
+ owner
none

Level 3

node owner posting owner comment owner object owner  
+ + + + private
+ + + secret
+ + enigma
+ + + senior
+ + major
+ admin
+ owner
none

Complex Principals

node:<list of node names>
(in the list of allowed principals this principal is called node)

Allows the operation to the node’s admin and to all nodes in the list. Names in the list are separated by commas.

only:<list of node names>
(in the list of allowed principals this principal is called only)

Allows the operation to all nodes in the list. Names in the list are separated by commas.

f:<friend group ID>
(in the list of allowed principals this principal is called friends)

Allows the operation to the node’s admin and to the members of a particular group of friends.

subscribed

Allows the operation to the node’s admin, and to all nodes this node is subscribed to.

signed

Allows the operation to any authenticated client.

public

Allows the operation to any client, including unauthenticated.

unset

This is a special value used in overrides. It means that the higher-level object does not override the permission, so the object’s own permission takes effect.