Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( OpRead = "Read" OpWrite = "Write" OpModify = "Modify" )
var ( // Read is used when doing a query. Read = &Operation{ Code: 4, Name: OpRead, } // Write is used when mutating data. Write = &Operation{ Code: 2, Name: OpWrite, } // Modify is used when altering the schema or dropping data. Modify = &Operation{ Code: 1, Name: OpModify, } )
var ( // CmdAcl is the sub-command used to manage the ACL system. CmdAcl x.SubCommand )
Functions ¶
func CreateGroupNQuads ¶
CreateGroupNQuads cretes NQuads needed to store a group with the give ID.
func CreateUserNQuads ¶
CreateUserNQuads creates the NQuads needed to store a user with the given ID and password in the ACL system.
func GetGroupIDs ¶
GetGroupIDs returns a slice containing the group ids of all the given groups.
Types ¶
type Acl ¶
type Acl struct {
Predicate string `json:"dgraph.rule.predicate"`
Perm int32 `json:"dgraph.rule.permission"`
}
Acl represents the permissions in the ACL system. An Acl can have a predicate and permission for that predicate.
type AclEntity ¶
type AclEntity interface {
// GetUid returns the UID of the entity.
// The implementation of GetUid must check the case that the entity is nil
// and return an empty string accordingly.
GetUid() string
}
AclEntity is an interface that must be met by all the types of entities (i.e users, groups) in the ACL system.
type Group ¶
type Group struct {
Uid string `json:"uid"`
GroupID string `json:"dgraph.xid"`
Users []User `json:"~dgraph.user.group"`
Rules []Acl `json:"dgraph.acl.rule"`
}
Group represents a group in the ACL system.
func UnmarshalGroup ¶
UnmarshalGroup extracts the first Group pointed by the groupKey in the query response.
func UnmarshalGroups ¶
UnmarshalGroups extracts a sequence of groups from the input.
type User ¶
type User struct {
Uid string `json:"uid"`
UserID string `json:"dgraph.xid"`
Password string `json:"dgraph.password"`
Namespace uint64 `json:"namespace"`
PasswordMatch bool `json:"password_match"`
Groups []Group `json:"dgraph.user.group"`
}
User represents a user in the ACL system.
func UnmarshalUser ¶
UnmarshalUser extracts the first User pointed by the userKey in the query response.