Documentation ¶
Index ¶
- func CheckExists(ctx context.Context, txn *dgo.Txn, uid string) bool
- func FingerprintExists(ctx context.Context, txn *dgo.Txn, fingerprint []byte) bool
- func ImportSchema(dg *dgo.Dgraph, drop bool) error
- func ImportStandardSet(repo node.Repo) (userID string, adminID string, err error)
- func NameExists(ctx context.Context, txn *dgo.Txn, name, namespace, parent string) bool
- func NewDGraphRepo(dg *dgo.Dgraph) node.Repo
- type Account
- type DGraphRepo
- func (s *DGraphRepo) AssignOwner(ctx context.Context, ownerID, acccountID string) (err error)
- func (s *DGraphRepo) Authenticate(ctx context.Context, username, password string) (success bool, uid string, defaultNamespace string, err error)
- func (s *DGraphRepo) Authorize(ctx context.Context, account, node, action string, inherit bool) (err error)
- func (s *DGraphRepo) AuthorizeNamespace(ctx context.Context, account, namespaceID string, action nodepb.Action) (err error)
- func (s *DGraphRepo) CreateNamespace(ctx context.Context, name string) (id string, err error)
- func (s *DGraphRepo) CreateObject(ctx context.Context, name, parentID, kind, namespaceID string) (id string, err error)
- func (s *DGraphRepo) CreateUserAccount(ctx context.Context, username, password string, isRoot, isAdmin, enabled bool) (uid string, err error)
- func (s *DGraphRepo) DeleteAccount(ctx context.Context, request *nodepb.DeleteAccountRequest) (err error)
- func (s *DGraphRepo) DeleteObject(ctx context.Context, uid string) (err error)
- func (s *DGraphRepo) DeletePermissionInNamespace(ctx context.Context, namespaceID, accountID string) (err error)
- func (s *DGraphRepo) GetAccount(ctx context.Context, name string) (account *nodepb.Account, err error)
- func (s *DGraphRepo) GetNamespace(ctx context.Context, namespacename string) (namespace *nodepb.Namespace, err error)
- func (s *DGraphRepo) GetNamespaceID(ctx context.Context, namespaceID string) (namespace *nodepb.Namespace, err error)
- func (s *DGraphRepo) GetRetentionPeriods(ctx context.Context) (retentionperiod []int, err error)
- func (s *DGraphRepo) HardDeleteNamespace(ctx context.Context, datecondition string, rp string) (err error)
- func (s *DGraphRepo) IsAuthorized(ctx context.Context, node, accountid, action string) (decision bool, err error)
- func (s *DGraphRepo) IsAuthorizedNamespace(ctx context.Context, namespaceid, account string, action nodepb.Action) (decision bool, err error)
- func (s *DGraphRepo) ListAccounts(ctx context.Context) (accounts []*nodepb.Account, err error)
- func (s *DGraphRepo) ListAccountsforAdmin(ctx context.Context, requestorID string) (accounts []*nodepb.Account, err error)
- func (s *DGraphRepo) ListForAccount(ctx context.Context, account string, namespaceid string, recurse bool) (inheritedObjects []*nodepb.Object, err error)
- func (s *DGraphRepo) ListNamespaces(ctx context.Context) (namespaces []*nodepb.Namespace, err error)
- func (s *DGraphRepo) ListNamespacesForAccount(ctx context.Context, accountID string) (namespaces []*nodepb.Namespace, err error)
- func (s *DGraphRepo) ListPermissionsInNamespace(ctx context.Context, namespaceid string) (permissions []*nodepb.Permission, err error)
- func (s *DGraphRepo) RemoveOwner(ctx context.Context, ownerID, acccountID string) (err error)
- func (s *DGraphRepo) SetPassword(ctx context.Context, accountid, password string) error
- func (s *DGraphRepo) SoftDeleteNamespace(ctx context.Context, namespaceID string) (err error)
- func (s *DGraphRepo) UpdateAccount(ctx context.Context, account *nodepb.UpdateAccountRequest, isself bool) (err error)
- func (s *DGraphRepo) UpdateNamespace(ctx context.Context, namespace *nodepb.UpdateNamespaceRequest) (err error)
- func (s *DGraphRepo) UserExists(ctx context.Context, account string) (exists bool, err error)
- type Namespace
- type Node
- type Object
- type UsernameCredential
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckExists ¶
CheckExists is a method to check if the object already exists
func FingerprintExists ¶
FingerprintExists is a method to execute Dgraph Query to check if the finger print is present in the DB
func ImportSchema ¶
ImportSchema is a method to import the schema in Dgraph DB for tests
func ImportStandardSet ¶
ImportStandardSet is a method to impor the test data for tests
func NameExists ¶
NameExists is a method to check if the object name already exists
Types ¶
type Account ¶
type Account struct { Node Name string `json:"name,omitempty"` IsRoot bool `json:"isRoot"` IsAdmin bool `json:"isAdmin"` Enabled bool `json:"enabled"` AccessTo []*Object `json:"access.to,omitempty"` AccessToNamespace []*Namespace `json:"access.to.namespace,omitempty"` DefaultNamespace []*Namespace `json:"default.namespace"` HasCredentials []*UsernameCredential `json:"has.credentials,omitempty"` Owns []*Account `json:"owns,omitempty"` OwnedBy []*Account `json:"~owns,omitempty"` }
Account Data structure for Dgraph database
type DGraphRepo ¶
DGraphRepo is a Data type for executing Dgraph Query
func (*DGraphRepo) AssignOwner ¶
func (s *DGraphRepo) AssignOwner(ctx context.Context, ownerID, acccountID string) (err error)
AssignOwner is a method to delete the Account
func (*DGraphRepo) Authenticate ¶
func (s *DGraphRepo) Authenticate(ctx context.Context, username, password string) (success bool, uid string, defaultNamespace string, err error)
Authenticate is a method to authenticate the user credentials
func (*DGraphRepo) Authorize ¶
func (s *DGraphRepo) Authorize(ctx context.Context, account, node, action string, inherit bool) (err error)
Authorize is a method to give access to the user
func (*DGraphRepo) AuthorizeNamespace ¶
func (s *DGraphRepo) AuthorizeNamespace(ctx context.Context, account, namespaceID string, action nodepb.Action) (err error)
AuthorizeNamespace is a method to authorize a user to a namespace
func (*DGraphRepo) CreateNamespace ¶
CreateNamespace is a method to execute Dgraph Query to create Namespaces
func (*DGraphRepo) CreateObject ¶
func (s *DGraphRepo) CreateObject(ctx context.Context, name, parentID, kind, namespaceID string) (id string, err error)
CreateObject is a method to execute Dgraph query to create objects
func (*DGraphRepo) CreateUserAccount ¶
func (s *DGraphRepo) CreateUserAccount(ctx context.Context, username, password string, isRoot, isAdmin, enabled bool) (uid string, err error)
CreateUserAccount is a method to Create User Account for Infinimesh
func (*DGraphRepo) DeleteAccount ¶
func (s *DGraphRepo) DeleteAccount(ctx context.Context, request *nodepb.DeleteAccountRequest) (err error)
DeleteAccount is a method to delete the Account
func (*DGraphRepo) DeleteObject ¶
func (s *DGraphRepo) DeleteObject(ctx context.Context, uid string) (err error)
DeleteObject is a method to execute Dgraph query to delete objects
func (*DGraphRepo) DeletePermissionInNamespace ¶
func (s *DGraphRepo) DeletePermissionInNamespace(ctx context.Context, namespaceID, accountID string) (err error)
DeletePermissionInNamespace is a method to execute Dgraph Query to delete permissions for a Namespaces for an account
func (*DGraphRepo) GetAccount ¶
func (s *DGraphRepo) GetAccount(ctx context.Context, name string) (account *nodepb.Account, err error)
GetAccount is a method to Get details of an Account
func (*DGraphRepo) GetNamespace ¶
func (s *DGraphRepo) GetNamespace(ctx context.Context, namespacename string) (namespace *nodepb.Namespace, err error)
GetNamespace is a method to execute Dgraph Query to get the namespace based on Name
func (*DGraphRepo) GetNamespaceID ¶
func (s *DGraphRepo) GetNamespaceID(ctx context.Context, namespaceID string) (namespace *nodepb.Namespace, err error)
GetNamespaceID is a method to execute Dgraph Query to get the namespace based on ID
func (*DGraphRepo) GetRetentionPeriods ¶
func (s *DGraphRepo) GetRetentionPeriods(ctx context.Context) (retentionperiod []int, err error)
GetRetentionPeriods is a method to get all the different retention periods for the namespaces
func (*DGraphRepo) HardDeleteNamespace ¶
func (s *DGraphRepo) HardDeleteNamespace(ctx context.Context, datecondition string, rp string) (err error)
HardDeleteNamespace is a method to execute Dgraph Query that deletes a namespace permantly
func (*DGraphRepo) IsAuthorized ¶
func (s *DGraphRepo) IsAuthorized(ctx context.Context, node, accountid, action string) (decision bool, err error)
IsAuthorized is a method to check if the given account has the mentioned action for the node
func (*DGraphRepo) IsAuthorizedNamespace ¶
func (s *DGraphRepo) IsAuthorizedNamespace(ctx context.Context, namespaceid, account string, action nodepb.Action) (decision bool, err error)
IsAuthorizedNamespace is a method to execute Dgraph Query that returns if the access to the namespace for an account is true or false
func (*DGraphRepo) ListAccounts ¶
ListAccounts is a method to List details of all Account
func (*DGraphRepo) ListAccountsforAdmin ¶
func (s *DGraphRepo) ListAccountsforAdmin(ctx context.Context, requestorID string) (accounts []*nodepb.Account, err error)
ListAccountsforAdmin is a method to List accounts owned by an Admin user
func (*DGraphRepo) ListForAccount ¶
func (s *DGraphRepo) ListForAccount(ctx context.Context, account string, namespaceid string, recurse bool) (inheritedObjects []*nodepb.Object, err error)
ListForAccount is a method to execute Dgraph query to list all the objects for an account
func (*DGraphRepo) ListNamespaces ¶
func (s *DGraphRepo) ListNamespaces(ctx context.Context) (namespaces []*nodepb.Namespace, err error)
ListNamespaces is a method to execute Dgraph Query to List details of all Namespaces
func (*DGraphRepo) ListNamespacesForAccount ¶
func (s *DGraphRepo) ListNamespacesForAccount(ctx context.Context, accountID string) (namespaces []*nodepb.Namespace, err error)
ListNamespacesForAccount is a method to execute Dgraph Query to list Namespaces for an Account
func (*DGraphRepo) ListPermissionsInNamespace ¶
func (s *DGraphRepo) ListPermissionsInNamespace(ctx context.Context, namespaceid string) (permissions []*nodepb.Permission, err error)
ListPermissionsInNamespace is a method to execute Dgraph Query to list permissions for all accounts for a Namespace
func (*DGraphRepo) RemoveOwner ¶
func (s *DGraphRepo) RemoveOwner(ctx context.Context, ownerID, acccountID string) (err error)
RemoveOwner is a method to delete the Account.
func (*DGraphRepo) SetPassword ¶
func (s *DGraphRepo) SetPassword(ctx context.Context, accountid, password string) error
SetPassword is a method to change the password of the user account
func (*DGraphRepo) SoftDeleteNamespace ¶
func (s *DGraphRepo) SoftDeleteNamespace(ctx context.Context, namespaceID string) (err error)
SoftDeleteNamespace is a method to execute Dgraph Query that mark the namespace for deletion
func (*DGraphRepo) UpdateAccount ¶
func (s *DGraphRepo) UpdateAccount(ctx context.Context, account *nodepb.UpdateAccountRequest, isself bool) (err error)
UpdateAccount is a method to Udpdate details of an Account
func (*DGraphRepo) UpdateNamespace ¶
func (s *DGraphRepo) UpdateNamespace(ctx context.Context, namespace *nodepb.UpdateNamespaceRequest) (err error)
UpdateNamespace is a method to execute Dgraph Query to Udpdate details of an Namespace
func (*DGraphRepo) UserExists ¶
UserExists is a method to check if the user is present in the Dgraph DB
type Namespace ¶
type Namespace struct { Node Name string `json:"name,omitempty"` MarkForDeletion bool `json:"markfordeletion,omitempty"` DeleteInitiationTime string `json:"deleteinitiationtime,omitempty"` RetentionPeriod int32 `json:"retentionperiod,omitempty"` Owns []*Object `json:"owns,omitempty"` AccessedBy []Account `json:"~access.to.namespace"` AccessToPermission string `json:"access.to.namespace|permission,omitempty"` }
Namespace Data structure for Dgraph database
type Object ¶
type Object struct { Node Name string `json:"name,omitempty"` Kind string `json:"kind,omitempty"` OwnedBy []*Namespace `json:"~owns,omitempty"` Children []*Object `json:"children"` Parent []Node `json:"~children"` // Namespace or Object AccessedBy []Account `json:"~access.to"` AccessToPermission string `json:"access.to|permission,omitempty"` AccessToInherit bool `json:"access.to|inherit"` }
Object Data structure for Dgraph database