Documentation
¶
Index ¶
- Variables
- func NewActivity(message string, ts time.Time, eventID string, vars map[string]interface{}) libregraph.Activity
- type ActivityOption
- func WithOldResource(ref *provider.Reference) ActivityOption
- func WithResource(ref *provider.Reference, addSpace bool, explicitResourceName string) ActivityOption
- func WithSharee(uid *user.UserId, gid *group.GroupId) ActivityOption
- func WithSpace(spaceid *provider.StorageSpaceId) ActivityOption
- func WithTranslation(t *l10n.Translator, locale string, key string, values []string) ActivityOption
- func WithTrashedResource(ref *provider.Reference, rid *provider.ResourceId) ActivityOption
- func WithUser(uid *user.UserId, u *user.User, impersonator *user.User) ActivityOption
- func WithVar(key, id, name string) ActivityOption
- type ActivitylogService
- func (a *ActivitylogService) Activities(rid *provider.ResourceId) ([]RawActivity, error)
- func (a *ActivitylogService) AddActivity(initRef *provider.Reference, eventID string, timestamp time.Time) error
- func (a *ActivitylogService) AddActivityTrashed(resourceID *provider.ResourceId, reference *provider.Reference, eventID string, ...) error
- func (a *ActivitylogService) AddSpaceActivity(spaceID *provider.StorageSpaceId, eventID string, timestamp time.Time) error
- func (s *ActivitylogService) GetVars(ctx context.Context, opts ...ActivityOption) (map[string]interface{}, error)
- func (s *ActivitylogService) HandleGetItemActivities(w http.ResponseWriter, r *http.Request)
- func (a *ActivitylogService) RemoveActivities(rid *provider.ResourceId, toDelete map[string]struct{}) error
- func (a *ActivitylogService) RemoveResource(rid *provider.ResourceId) error
- func (a *ActivitylogService) Run()
- func (s *ActivitylogService) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type Actor
- type GetActivitiesResponse
- type Option
- func Config(c *config.Config) Option
- func GatewaySelector(gatewaySelector pool.Selectable[gateway.GatewayAPIClient]) Option
- func HistoryClient(hc ehsvc.EventHistoryService) Option
- func Logger(log log.Logger) Option
- func Mux(m *chi.Mux) Option
- func RegisteredEvents(e []events.Unmarshaller) Option
- func Store(store microstore.Store) Option
- func Stream(s events.Stream) Option
- func TraceProvider(tp trace.TracerProvider) Option
- func ValueClient(vs settingssvc.ValueService) Option
- type Options
- type RawActivity
- type Resource
Constants ¶
This section is empty.
Variables ¶
var ( MessageResourceCreated = l10n.Template("{user} added {resource} to {folder}") MessageResourceUpdated = l10n.Template("{user} updated {resource} in {folder}") MessageResourceDownloaded = l10n.Template("{resource} was downloaded via public link {token}") MessageResourceTrashed = l10n.Template("{user} deleted {resource} from {folder}") MessageResourceMoved = l10n.Template("{user} moved {resource} to {folder}") MessageResourceRenamed = l10n.Template("{user} renamed {oldResource} to {resource}") MessageLinkCreated = l10n.Template("{user} shared {resource} via link") MessageLinkUpdated = l10n.Template("{user} updated {field} for a link {token} on {resource}") MessageLinkDeleted = l10n.Template("{user} removed link to {resource}") StrSomeField = l10n.Template("some field") StrPermission = l10n.Template("permission") StrPassword = l10n.Template("password") StrExpirationDate = l10n.Template("expiration date") StrDisplayName = l10n.Template("display name") StrDescription = l10n.Template("description") )
Translations
Functions ¶
func NewActivity ¶
func NewActivity(message string, ts time.Time, eventID string, vars map[string]interface{}) libregraph.Activity
NewActivity creates a new activity
Types ¶
type ActivityOption ¶
ActivityOption allows setting variables for an activity
func WithOldResource ¶
func WithOldResource(ref *provider.Reference) ActivityOption
WithOldResource sets the oldResource variable for an activity
func WithResource ¶
func WithResource(ref *provider.Reference, addSpace bool, explicitResourceName string) ActivityOption
WithResource sets the resource variable for an activity
func WithSharee ¶
func WithSharee(uid *user.UserId, gid *group.GroupId) ActivityOption
WithSharee sets the sharee variable for an activity
func WithSpace ¶
func WithSpace(spaceid *provider.StorageSpaceId) ActivityOption
WithSpace sets the space variable for an activity
func WithTranslation ¶
func WithTranslation(t *l10n.Translator, locale string, key string, values []string) ActivityOption
WithTranslation sets a variable that translation is needed for
func WithTrashedResource ¶
func WithTrashedResource(ref *provider.Reference, rid *provider.ResourceId) ActivityOption
WithTrashedResource sets the resource variable if the resource is trashed
func WithVar ¶
func WithVar(key, id, name string) ActivityOption
WithVar sets a variable for an activity
type ActivitylogService ¶
type ActivitylogService struct {
// contains filtered or unexported fields
}
ActivitylogService logs events per resource
func New ¶
func New(opts ...Option) (*ActivitylogService, error)
New creates a new ActivitylogService
func (*ActivitylogService) Activities ¶
func (a *ActivitylogService) Activities(rid *provider.ResourceId) ([]RawActivity, error)
Activities returns the activities for the given resource
func (*ActivitylogService) AddActivity ¶
func (a *ActivitylogService) AddActivity(initRef *provider.Reference, eventID string, timestamp time.Time) error
AddActivity adds the activity to the given resource and all its parents
func (*ActivitylogService) AddActivityTrashed ¶
func (a *ActivitylogService) AddActivityTrashed(resourceID *provider.ResourceId, reference *provider.Reference, eventID string, timestamp time.Time) error
AddActivityTrashed adds the activity to given trashed resource and all its former parents
func (*ActivitylogService) AddSpaceActivity ¶
func (a *ActivitylogService) AddSpaceActivity(spaceID *provider.StorageSpaceId, eventID string, timestamp time.Time) error
AddSpaceActivity adds the activity to the given spaceroot
func (*ActivitylogService) GetVars ¶
func (s *ActivitylogService) GetVars(ctx context.Context, opts ...ActivityOption) (map[string]interface{}, error)
GetVars calls other service to gather the required data for the activity variables
func (*ActivitylogService) HandleGetItemActivities ¶
func (s *ActivitylogService) HandleGetItemActivities(w http.ResponseWriter, r *http.Request)
HandleGetItemActivities handles the request to get the activities of an item.
func (*ActivitylogService) RemoveActivities ¶
func (a *ActivitylogService) RemoveActivities(rid *provider.ResourceId, toDelete map[string]struct{}) error
RemoveActivities removes the activities from the given resource
func (*ActivitylogService) RemoveResource ¶
func (a *ActivitylogService) RemoveResource(rid *provider.ResourceId) error
RemoveResource removes the resource from the store
func (*ActivitylogService) ServeHTTP ¶
func (s *ActivitylogService) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface.
type GetActivitiesResponse ¶
type GetActivitiesResponse struct {
Activities []libregraph.Activity `json:"value"`
}
GetActivitiesResponse is the response on GET activities requests
type Option ¶
type Option func(*Options)
Option for the activitylog service
func GatewaySelector ¶
func GatewaySelector(gatewaySelector pool.Selectable[gateway.GatewayAPIClient]) Option
GatewaySelector adds a grpc client selector for the gateway service
func HistoryClient ¶
func HistoryClient(hc ehsvc.EventHistoryService) Option
HistoryClient adds a grpc client for the eventhistory service
func RegisteredEvents ¶
func RegisteredEvents(e []events.Unmarshaller) Option
RegisteredEvents registers the events the service should listen to
func TraceProvider ¶
func TraceProvider(tp trace.TracerProvider) Option
TraceProvider adds a tracer provider for the activitylog service
func ValueClient ¶
func ValueClient(vs settingssvc.ValueService) Option
ValueClient adds a grpc client for the value service
type Options ¶
type Options struct {
Logger log.Logger
Config *config.Config
TraceProvider trace.TracerProvider
Stream events.Stream
RegisteredEvents []events.Unmarshaller
Store microstore.Store
GatewaySelector pool.Selectable[gateway.GatewayAPIClient]
Mux *chi.Mux
HistoryClient ehsvc.EventHistoryService
ValueClient settingssvc.ValueService
}
Options for the activitylog service