types

package
v2.0.0-beta.6 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Sharing
	ActionShareCreated            = "file_shared"
	ActionSharePermissionUpdated  = "share_permission_updated"
	ActionShareDisplayNameUpdated = "share_name_updated"
	ActionSharePasswordUpdated    = "share_password_updated"
	ActionShareExpirationUpdated  = "share_expiration_updated"
	ActionShareRemoved            = "file_unshared"
	ActionShareAccepted           = "share_accepted"
	ActionShareDeclined           = "share_declined"
	ActionLinkAccessed            = "public_link_accessed"

	// Files
	ActionContainerCreated    = "container_create"
	ActionFileCreated         = "file_create"
	ActionFileRead            = "file_read"
	ActionFileTrashed         = "file_delete"
	ActionFileRenamed         = "file_rename"
	ActionFilePurged          = "file_trash_delete"
	ActionFileRestored        = "file_trash_restore"
	ActionFileVersionRestored = "file_version_restore"

	// Spaces
	ActionSpaceCreated  = "space_created"
	ActionSpaceRenamed  = "space_renamed"
	ActionSpaceDisabled = "space_disabled"
	ActionSpaceEnabled  = "space_enabled"
	ActionSpaceDeleted  = "space_deleted"

	// Users
	ActionUserCreated        = "user_created"
	ActionUserDeleted        = "user_deleted"
	ActionUserFeatureChanged = "user_feature_changed"

	// Groups
	ActionGroupCreated       = "group_created"
	ActionGroupDeleted       = "group_deleted"
	ActionGroupMemberAdded   = "group_member_added"
	ActionGroupMemberRemoved = "group_member_removed"
)

short identifiers for audit actions

Variables

This section is empty.

Functions

func MessageContainerCreated

func MessageContainerCreated(executant, item string) string

MessageContainerCreated returns the human readable string that describes the action

func MessageFileCreated

func MessageFileCreated(executant, item string) string

MessageFileCreated returns the human readable string that describes the action

func MessageFilePurged

func MessageFilePurged(executant, item string) string

MessageFilePurged returns the human readable string that describes the action

func MessageFileRead

func MessageFileRead(executant, item string) string

MessageFileRead returns the human readable string that describes the action

func MessageFileRenamed

func MessageFileRenamed(executant, item, oldpath, newpath string) string

MessageFileRenamed returns the human readable string that describes the action

func MessageFileRestored

func MessageFileRestored(executant, item, path string) string

MessageFileRestored returns the human readable string that describes the action

func MessageFileTrashed

func MessageFileTrashed(executant, item string) string

MessageFileTrashed returns the human readable string that describes the action

func MessageFileVersionRestored

func MessageFileVersionRestored(executant, item, version string) string

MessageFileVersionRestored returns the human readable string that describes the action

func MessageGroupCreated

func MessageGroupCreated(executant, groupID string) string

MessageGroupCreated returns the human readable string that describes the action

func MessageGroupDeleted

func MessageGroupDeleted(executant, groupID string) string

MessageGroupDeleted returns the human readable string that describes the action

func MessageGroupMemberAdded

func MessageGroupMemberAdded(executant, userID, groupID string) string

MessageGroupMemberAdded returns the human readable string that describes the action

func MessageGroupMemberRemoved

func MessageGroupMemberRemoved(executant, userID, groupID string) string

MessageGroupMemberRemoved returns the human readable string that describes the action

func MessageLinkAccessed

func MessageLinkAccessed(linkid string, success bool) string

MessageLinkAccessed returns the human readable string that describes the action

func MessageLinkCreated

func MessageLinkCreated(sharer, item, shareid string) string

MessageLinkCreated returns the human readable string that describes the action

func MessageLinkRemoved

func MessageLinkRemoved(executant, shareid string) string

MessageLinkRemoved returns the human readable string that describes the action

func MessageLinkUpdated

func MessageLinkUpdated(sharer, shareid, fieldUpdated string) string

MessageLinkUpdated returns the human readable string that describes the action

func MessageShareAccepted

func MessageShareAccepted(userid, shareid, sharerid string) string

MessageShareAccepted returns the human readable string that describes the action

func MessageShareCreated

func MessageShareCreated(sharer, item, grantee string) string

MessageShareCreated returns the human readable string that describes the action

func MessageShareDeclined

func MessageShareDeclined(userid, shareid, sharerid string) string

MessageShareDeclined returns the human readable string that describes the action

func MessageShareRemoved

func MessageShareRemoved(sharer, shareid, itemid string) string

MessageShareRemoved returns the human readable string that describes the action

func MessageShareUpdated

func MessageShareUpdated(sharer, shareID, fieldUpdated string) string

MessageShareUpdated returns the human readable string that describes the action

func MessageSpaceCreated

func MessageSpaceCreated(executant, spaceID, name string) string

MessageSpaceCreated returns the human readable string that describes the action

func MessageSpaceDeleted

func MessageSpaceDeleted(executant, spaceID string) string

MessageSpaceDeleted returns the human readable string that describes the action

func MessageSpaceDisabled

func MessageSpaceDisabled(executant, spaceID string) string

MessageSpaceDisabled returns the human readable string that describes the action

func MessageSpaceEnabled

func MessageSpaceEnabled(executant, spaceID string) string

MessageSpaceEnabled returns the human readable string that describes the action

func MessageSpaceRenamed

func MessageSpaceRenamed(executant, spaceID, name string) string

MessageSpaceRenamed returns the human readable string that describes the action

func MessageUserCreated

func MessageUserCreated(executant, userID string) string

MessageUserCreated returns the human readable string that describes the action

func MessageUserDeleted

func MessageUserDeleted(executant, userID string) string

MessageUserDeleted returns the human readable string that describes the action

func MessageUserFeatureChanged

func MessageUserFeatureChanged(executant, userID string, features []events.UserFeature) string

MessageUserFeatureChanged returns the human readable string that describes the action

func RegisteredEvents

func RegisteredEvents() []events.Unmarshaller

RegisteredEvents returns the events the service is registered for

Types

type AuditEvent

type AuditEvent struct {
	RemoteAddr string // the remote client IP
	User       string // the UID of the user performing the action. Or "IP x.x.x.x.", "cron", "CLI", "unknown"
	URL        string // the process request URI
	Method     string // the HTTP request method
	UserAgent  string // the HTTP request user agent
	Time       string // the time of the event eg: 2018-05-08T08:26:00+00:00
	App        string // always 'admin_audit'
	Message    string // sentence explaining the action
	Action     string // unique action identifier eg: file_delete or public_link_created
	CLI        bool   // if the action was performed from the CLI
	Level      int    // the log level of the entry (usually 1 for audit events)
}

AuditEvent is the basic audit event

func BasicAuditEvent

func BasicAuditEvent(uid string, ctime string, msg string, action string) AuditEvent

BasicAuditEvent creates an AuditEvent from given values

type AuditEventContainerCreated

type AuditEventContainerCreated struct {
	AuditEventFiles
}

AuditEventContainerCreated is the event logged when a container is created

func ContainerCreated

ContainerCreated converts a ContainerCreated event to an AuditEventContainerCreated

type AuditEventFileCopied

type AuditEventFileCopied struct {
	AuditEventFiles
}

AuditEventFileCopied is the event logged when a file is copied TODO: copy is a download&upload for now. How to know it was a copy? FIXME: implement

type AuditEventFileCreated

type AuditEventFileCreated struct {
	AuditEventFiles
}

AuditEventFileCreated is the event logged when a file is created

func FileUploaded

func FileUploaded(ev events.FileUploaded) AuditEventFileCreated

FileUploaded converts a FileUploaded event to an AuditEventFileCreated

type AuditEventFileDeleted

type AuditEventFileDeleted struct {
	AuditEventFiles
}

AuditEventFileDeleted is the event logged when a file is deleted (aka trashed)

func ItemTrashed

ItemTrashed converts a ItemTrashed event to an AuditEventFileDeleted

type AuditEventFilePurged

type AuditEventFilePurged struct {
	AuditEventFiles
}

AuditEventFilePurged is the event logged when a file is purged (deleted from trashbin)

func ItemPurged

func ItemPurged(ev events.ItemPurged) AuditEventFilePurged

ItemPurged converts a ItemPurged event to an AuditEventFilePurged

type AuditEventFileRead

type AuditEventFileRead struct {
	AuditEventFiles
}

AuditEventFileRead is the event logged when a file is read (aka downloaded)

func FileDownloaded

func FileDownloaded(ev events.FileDownloaded) AuditEventFileRead

FileDownloaded converts a FileDownloaded event to an AuditEventFileRead

type AuditEventFileRenamed

type AuditEventFileRenamed struct {
	AuditEventFiles

	OldPath string
}

AuditEventFileRenamed is the event logged when a file is renamed (moved)

func ItemMoved

ItemMoved converts a ItemMoved event to an AuditEventFileRenamed

type AuditEventFileRestored

type AuditEventFileRestored struct {
	AuditEventFiles

	OldPath string
}

AuditEventFileRestored is the event logged when a file is restored (from trashbin)

func ItemRestored

ItemRestored converts a ItemRestored event to an AuditEventFileRestored

type AuditEventFileUpdated

type AuditEventFileUpdated struct {
	AuditEventFiles
}

AuditEventFileUpdated is the event logged when a file is updated TODO: How to differentiate between new uploads and new version uploads? FIXME: implement

type AuditEventFileVersionDeleted

type AuditEventFileVersionDeleted struct {
	AuditEventFiles
}

AuditEventFileVersionDeleted is the event logged when a file version is deleted TODO: is this even possible?

type AuditEventFileVersionRestored

type AuditEventFileVersionRestored struct {
	AuditEventFiles

	Key string
}

AuditEventFileVersionRestored is the event logged when a file version is restored

func FileVersionRestored

FileVersionRestored converts a FileVersionRestored event to an AuditEventFileVersionRestored

type AuditEventFiles

type AuditEventFiles struct {
	AuditEvent

	Path   string // The full path to the create file.
	Owner  string // The UID of the owner of the file.
	FileID string // The newly created files identifier.
}

AuditEventFiles is the basic audit event for files

func FilesAuditEvent

func FilesAuditEvent(base AuditEvent, itemid, owner, path string) AuditEventFiles

FilesAuditEvent creates an AuditEventFiles from the given values

type AuditEventGroupCreated

type AuditEventGroupCreated struct {
	AuditEvent
	GroupID string
}

AuditEventGroupCreated is the event logged when a group is created

func GroupCreated

GroupCreated converts a GroupCreated event to an AuditEventGroupCreated

type AuditEventGroupDeleted

type AuditEventGroupDeleted struct {
	AuditEvent
	GroupID string
}

AuditEventGroupDeleted is the event logged when a group is deleted

func GroupDeleted

GroupDeleted converts a GroupDeleted event to an AuditEventGroupDeleted

type AuditEventGroupMemberAdded

type AuditEventGroupMemberAdded struct {
	AuditEvent
	GroupID string
	UserID  string
}

AuditEventGroupMemberAdded is the event logged when a group member is added

func GroupMemberAdded

GroupMemberAdded converts a GroupMemberAdded event to an AuditEventGroupMemberAdded

type AuditEventGroupMemberRemoved

type AuditEventGroupMemberRemoved struct {
	AuditEvent
	GroupID string
	UserID  string
}

AuditEventGroupMemberRemoved is the event logged when a group member is removed

func GroupMemberRemoved

GroupMemberRemoved converts a GroupMemberRemoved event to an AuditEventGroupMemberRemove

type AuditEventLinkAccessed

type AuditEventLinkAccessed struct {
	AuditEventSharing
	ShareToken string // The share token.
	Success    bool   // If the request was successful.
	ItemType   string // file or folder
}

AuditEventLinkAccessed is the event logged when a link is accessed

func LinkAccessFailed

func LinkAccessFailed(ev events.LinkAccessFailed) AuditEventLinkAccessed

LinkAccessFailed converts a LinkAccessFailed event to an AuditEventLinkAccessed

func LinkAccessed

LinkAccessed converts a LinkAccessed event to an AuditEventLinkAccessed

type AuditEventReceivedShareUpdated

type AuditEventReceivedShareUpdated struct {
	AuditEventSharing
	ItemType  string // file or folder
	ShareType string // group user or link
	ShareWith string // The UID or GID of the share recipient.
}

AuditEventReceivedShareUpdated is the event logged when a share is accepted or declined

func ReceivedShareUpdated

ReceivedShareUpdated converts a ReceivedShareUpdated event to an AuditEventReceivedShareUpdated

type AuditEventShareCreated

type AuditEventShareCreated struct {
	AuditEventSharing

	ItemType       string // file or folder
	ExpirationDate string // The text expiration date in format 'yyyy-mm-dd'
	SharePass      bool   // If the share is password protected.
	Permissions    string // The permissions string eg: "READ"
	ShareType      string // group user or link
	ShareWith      string // The UID or GID of the share recipient. (not available for public link)
	ShareOwner     string // The UID of the share owner.
	ShareToken     string // For link shares the unique token, else null
}

AuditEventShareCreated is the event logged when a share is created

func LinkCreated

LinkCreated converts a ShareCreated Event to an AuditEventShareCreated

func ShareCreated

ShareCreated converts a ShareCreated Event to an AuditEventShareCreated

type AuditEventShareRemoved

type AuditEventShareRemoved struct {
	AuditEventSharing
	ItemType  string // file or folder
	ShareType string // group user or link
	ShareWith string // The UID or GID of the share recipient.
}

AuditEventShareRemoved is the event logged when a share is removed

func LinkRemoved

LinkRemoved converts a LinkRemoved event to an AuditEventShareRemoved

func ShareRemoved

ShareRemoved converts a ShareRemoved event to an AuditEventShareRemoved

type AuditEventShareUpdated

type AuditEventShareUpdated struct {
	AuditEventSharing

	ItemType       string // file or folder
	ExpirationDate string // The text expiration date in format 'yyyy-mm-dd'
	SharePass      bool   // If the share is password protected.
	Permissions    string // The permissions string eg: "READ"
	ShareType      string // group user or link
	ShareWith      string // The UID or GID of the share recipient. (not available for public link)
	ShareOwner     string // The UID of the share owner.
	ShareToken     string // For link shares the unique token, else null
}

AuditEventShareUpdated is the event logged when a share is updated

func LinkUpdated

LinkUpdated converts a LinkUpdated event to an AuditEventShareUpdated

func ShareUpdated

ShareUpdated converts a ShareUpdated event to an AuditEventShareUpdated

type AuditEventSharing

type AuditEventSharing struct {
	AuditEvent

	FileID  string // The file identifier for the item shared.
	Owner   string // The UID of the owner of the shared item.
	Path    string // The path to the shared item.
	ShareID string // The sharing identifier. (not available for public_link_accessed or when recipient unshares)
}

AuditEventSharing is the basic audit event for shares

func SharingAuditEvent

func SharingAuditEvent(shareid string, fileid string, uid string, base AuditEvent) AuditEventSharing

SharingAuditEvent creates an AuditEventSharing from given values

type AuditEventSpaceCreated

type AuditEventSpaceCreated struct {
	AuditEventSpaces

	Owner    string
	RootItem string
	Name     string
	Type     string
}

AuditEventSpaceCreated is the event logged when a space is created

func SpaceCreated

SpaceCreated converts a SpaceCreated event to an AuditEventSpaceCreated

type AuditEventSpaceDeleted

type AuditEventSpaceDeleted struct {
	AuditEventSpaces
}

AuditEventSpaceDeleted is the event logged when a space is deleted

func SpaceDeleted

SpaceDeleted converts a SpaceDeleted event to an AuditEventSpaceDeleted

type AuditEventSpaceDisabled

type AuditEventSpaceDisabled struct {
	AuditEventSpaces
}

AuditEventSpaceDisabled is the event logged when a space is disabled

func SpaceDisabled

SpaceDisabled converts a SpaceDisabled event to an AuditEventSpaceDisabled

type AuditEventSpaceEnabled

type AuditEventSpaceEnabled struct {
	AuditEventSpaces
}

AuditEventSpaceEnabled is the event logged when a space is (re-)enabled

func SpaceEnabled

SpaceEnabled converts a SpaceEnabled event to an AuditEventSpaceEnabled

type AuditEventSpaceRenamed

type AuditEventSpaceRenamed struct {
	AuditEventSpaces

	NewName string
}

AuditEventSpaceRenamed is the event logged when a space is renamed

func SpaceRenamed

SpaceRenamed converts a SpaceRenamed event to an AuditEventSpaceRenamed

type AuditEventSpaces

type AuditEventSpaces struct {
	AuditEvent

	SpaceID string
}

AuditEventSpaces is the basic audit event for spaces

func SpacesAuditEvent

func SpacesAuditEvent(base AuditEvent, spaceID string) AuditEventSpaces

SpacesAuditEvent creates an AuditEventSpaces from the given values

type AuditEventUserCreated

type AuditEventUserCreated struct {
	AuditEvent
	UserID string
}

AuditEventUserCreated is the event logged when a user is created

func UserCreated

UserCreated converts a UserCreated event to an AuditEventUserCreated

type AuditEventUserDeleted

type AuditEventUserDeleted struct {
	AuditEvent
	UserID string
}

AuditEventUserDeleted is the event logged when a user is deleted

func UserDeleted

UserDeleted converts a UserDeleted event to an AuditEventUserDeleted

type AuditEventUserFeatureChanged

type AuditEventUserFeatureChanged struct {
	AuditEvent
	UserID   string
	Features []events.UserFeature
}

AuditEventUserFeatureChanged is the event logged when a user feature is changed

func UserFeatureChanged

UserFeatureChanged converts a UserFeatureChanged event to an AuditEventUserFeatureChanged

Jump to

Keyboard shortcuts

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