share

package
v4.0.0-alpha1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2022 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const PasswordComplexitySuffix = "#$!Az1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	common.RuntimeHolder
}

func NewClient

func NewClient(ctx context.Context) *Client

func (*Client) AclsToCellAcls

func (sc *Client) AclsToCellAcls(ctx context.Context, acls []*idm.ACL) map[string]*rest.CellAcl

AclsToCellAcls Rewrites a flat list of ACLs to a structured map of CellAcls (more easily usable by clients).

func (*Client) CheckCellOptionsAgainstConfigs

func (sc *Client) CheckCellOptionsAgainstConfigs(ctx context.Context, request *rest.PutCellRequest) error

CheckCellOptionsAgainstConfigs loads specific share configurations from ACLs and checks that current cell complies with these.

func (*Client) CheckLinkOptionsAgainstConfigs

func (sc *Client) CheckLinkOptionsAgainstConfigs(ctx context.Context, link *rest.ShareLink, wss []*tree.WorkspaceRelativePath, files, folders bool) (PluginOptions, error)

CheckLinkOptionsAgainstConfigs loads specific share configurations from ACLs and checks that current link complies with these.

func (*Client) CheckLinkRootNodes

func (sc *Client) CheckLinkRootNodes(ctx context.Context, link *rest.ShareLink) (workspaces []*tree.WorkspaceRelativePath, files, folders bool, e error)

CheckLinkRootNodes loads the root nodes and check if one of the is readonly. If so, check that link permissions do not try to set the Upload mode.

func (*Client) ClearLostHiddenUsers

func (sc *Client) ClearLostHiddenUsers(ctx context.Context) error

ClearLostHiddenUsers makes sure that hidden users that are not linked to any existing link are removed. This is used during a migration to fix the missing users deletion prior to v2.0.0

func (*Client) CommonAclsForWorkspace

func (sc *Client) CommonAclsForWorkspace(ctx context.Context, workspaceId string) (result []*idm.ACL, detectedRoots []string, err error)

CommonAclsForWorkspace makes successive calls to ACL service to get all ACLs for a given workspace.

func (*Client) ComputeTargetAcls

func (sc *Client) ComputeTargetAcls(ctx context.Context, ownerUser *idm.User, cell *rest.Cell, workspaceId string, readonly bool, parentPolicy string) ([]*idm.ACL, error)

ComputeTargetAcls create ACL objects that should be applied for this cell.

func (*Client) DeleteHashDocument

func (sc *Client) DeleteHashDocument(ctx context.Context, shareId string) error

DeleteHashDocument removes link data from the storage.

func (*Client) DeleteHiddenUser

func (sc *Client) DeleteHiddenUser(ctx context.Context, link *rest.ShareLink) error

DeleteHiddenUser removes hidden user associated with this link

func (*Client) DeleteRootNodeRecursively

func (sc *Client) DeleteRootNodeRecursively(ctx context.Context, ownerName string, roomNode *tree.Node) error

DeleteRootNodeRecursively loads all children of a root node and delete them, including the .pydio hidden files when they are folders.

func (*Client) DeleteWorkspace

func (sc *Client) DeleteWorkspace(ctx context.Context, ownerUser *idm.User, scope idm.WorkspaceScope, workspaceId string, checker ContextEditableChecker) error

DeleteWorkspace deletes a workspace and associated policies and ACLs. It also deletes the room node if necessary.

func (*Client) DetectInheritedPolicy

func (sc *Client) DetectInheritedPolicy(ctx context.Context, roots []*tree.Node, loadedParents []*tree.WorkspaceRelativePath) (string, error)

func (*Client) DiffAcls

func (sc *Client) DiffAcls(ctx context.Context, initial []*idm.ACL, newOnes []*idm.ACL) (add []*idm.ACL, remove []*idm.ACL)

DiffAcls compares to slices of ACLs on their RoleID and Action and returns slices of Acls to add and to remove.

func (*Client) DiffReadRoles

func (sc *Client) DiffReadRoles(ctx context.Context, initial []*idm.ACL, newOnes []*idm.ACL) (add []string, remove []string)

DiffReadRoles detects the roles that have been globally added or removed, whatever the node.

func (*Client) GetOrCreateHiddenUser

func (sc *Client) GetOrCreateHiddenUser(ctx context.Context, ownerUser *idm.User, link *rest.ShareLink, passwordEnabled bool, updatePassword string, passwordHashed bool) (user *idm.User, err error)

GetOrCreateHiddenUser will load or create a user to create a ShareLink with.

func (*Client) GetOrCreateWorkspace

func (sc *Client) GetOrCreateWorkspace(ctx context.Context, ownerUser *idm.User, wsUuid string, scope idm.WorkspaceScope, label string, description string, updateIfNeeded bool) (*idm.Workspace, bool, error)

GetOrCreateWorkspace finds a workspace by its Uuid or creates it with the current user ResourcePolicies if it does not already exist.

func (*Client) GetTemplateACLsForMinisite

func (sc *Client) GetTemplateACLsForMinisite(ctx context.Context, roleId string, perms []rest.ShareLinkAccessType, aclClient idm.ACLServiceClient) (acls []*idm.ACL, err error)

GetTemplateACLsForMinisite loads actions and parameter acls from specific template roles.

func (*Client) InheritPolicies

func (sc *Client) InheritPolicies(ctx context.Context, policyName string, read, write bool) (string, error)

InheritPolicies find possible SecurityPolicy currently implied and compute a new one based on it.

func (*Client) InterpretInheritedPolicy

func (sc *Client) InterpretInheritedPolicy(ctx context.Context, name string) (read, write bool, e error)

InterpretInheritedPolicy translates a SecurityPolicy to read/write permissions for user readability

func (*Client) LoadCellAclsObjects

func (sc *Client) LoadCellAclsObjects(ctx context.Context, roomAcls map[string]*rest.CellAcl, checker ContextEditableChecker) error

LoadCellAclsObjects loads associated users / groups / roles based on the role Ids of the acls.

func (*Client) LoadDetectedRootNodes

func (sc *Client) LoadDetectedRootNodes(ctx context.Context, detectedRoots []string) (rootNodes map[string]*tree.Node)

LoadDetectedRootNodes find actual nodes in the tree, and enrich their metadata if they appear in many workspaces for the current user.

func (*Client) LoadHashDocumentData

func (sc *Client) LoadHashDocumentData(ctx context.Context, shareLink *rest.ShareLink, acls []*idm.ACL) error

LoadHashDocumentData loads link data from the storage (currently Docstore) by link Uuid.

func (*Client) OwnerResourcePolicies

func (sc *Client) OwnerResourcePolicies(ctx context.Context, ownerUser *idm.User, resourceId string) []*service.ResourcePolicy

OwnerResourcePolicies produces a set of policies given ownership to current context user, read/write to current context user, and write access to profile:admin (can be useful for admin).

func (*Client) ParseRootNodes

func (sc *Client) ParseRootNodes(ctx context.Context, shareRequest *rest.PutCellRequest) (*tree.Node, bool, error)

ParseRootNodes reads the request property to either create a new node using the "rooms" Virtual node, or just verify that the root nodes are not empty.

func (*Client) RootsParentWorkspaces

func (sc *Client) RootsParentWorkspaces(ctx context.Context, rr []*tree.Node) (ww []*tree.WorkspaceRelativePath, e error)

RootsParentWorkspaces reads parents and find the root node of the workspace

func (*Client) SearchHashDocumentForUser

func (sc *Client) SearchHashDocumentForUser(ctx context.Context, userLogin string) (*docstore.ShareDocument, error)

SearchHashDocumentForUser searches the DocStore to find documents that have either PRELOG_USER or PRESET_LOGIN with the passed userLogin value.

func (*Client) StoreHashDocument

func (sc *Client) StoreHashDocument(ctx context.Context, ownerUser *idm.User, link *rest.ShareLink, updateHash ...string) error

StoreHashDocument sends link data to the storage backend, currently the Docstore service.

func (*Client) UpdateACLsForHiddenUser

func (sc *Client) UpdateACLsForHiddenUser(ctx context.Context, roleId string, workspaceId string, rootNodes []*tree.Node, permissions []rest.ShareLinkAccessType, parentPolicy string, update bool) error

UpdateACLsForHiddenUser deletes and replaces access ACLs for a hidden user.

func (*Client) UpdatePoliciesFromAcls

func (sc *Client) UpdatePoliciesFromAcls(ctx context.Context, workspace *idm.Workspace, initial []*idm.ACL, target []*idm.ACL) bool

UpdatePoliciesFromAcls recomputes the required policies from acl changes.

func (*Client) WorkspaceToCellObject

func (sc *Client) WorkspaceToCellObject(ctx context.Context, workspace *idm.Workspace, checker ContextEditableChecker) (*rest.Cell, error)

WorkspaceToCellObject rewrites a workspace to a Cell object by reloading its ACLs.

func (*Client) WorkspaceToShareLinkObject

func (sc *Client) WorkspaceToShareLinkObject(ctx context.Context, workspace *idm.Workspace, checker ContextEditableChecker) (*rest.ShareLink, error)

WorkspaceToShareLinkObject converts a workspace to a rest.ShareLink model.

type ContextEditableChecker

type ContextEditableChecker interface {
	IsContextEditable(ctx context.Context, resourceId string, policies []*service.ResourcePolicy) bool
}

type PluginOptions

type PluginOptions struct {
	MaxExpiration      int
	MaxDownloads       int
	HashMinLength      int
	HashEditable       bool
	ShareForcePassword bool
	// contains filtered or unexported fields
}

Directories

Path Synopsis
Package rest exposes a REST API to manage shared rooms.
Package rest exposes a REST API to manage shared rooms.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL