share

package
v3.0.6+incompatible Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const PasswordComplexitySuffix = "#$!Az1"

Variables

This section is empty.

Functions

func AclsToCellAcls

func 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 CheckCellOptionsAgainstConfigs

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

func CheckLinkRootNodes

func 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 ClearLostHiddenUsers

func 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 CommonAclsForWorkspace

func 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 ComputeTargetAcls

func 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 DeleteHashDocument

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

func DeleteHiddenUser

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

DeleteHiddenUser removes hidden user associated with this link

func DeleteRootNodeRecursively

func 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 DeleteWorkspace

func 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 DetectInheritedPolicy

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

func DiffAcls

func 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 DiffReadRoles

func 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 GetOrCreateHiddenUser

func 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 GetOrCreateWorkspace

func 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 GetTemplateACLsForMinisite

func 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 InheritPolicies

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

func InterpretInheritedPolicy

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

func LoadCellAclsObjects

func 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 LoadDetectedRootNodes

func 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 LoadHashDocumentData

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

func OwnerResourcePolicies

func 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 ParseRootNodes

func 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 RootsParentWorkspaces

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

func SearchHashDocumentForUser

func 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 StoreHashDocument

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

func UpdateACLsForHiddenUser

func 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 UpdatePoliciesFromAcls

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

UpdatePoliciesFromAcls recomputes the required policies from acl changes.

func WorkspaceToCellObject

func 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 WorkspaceToShareLinkObject

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

Types

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
}

func CheckLinkOptionsAgainstConfigs

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

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