For each user, the Beego app creates a directory under /static/users/
in the form of: /static/users/USER_ID/private
and /static/users/USER_ID/public
, where USER_ID the ID of each user.
I want to protect the private files so that only the user owning them to be able to access with the use of Filters.
The pattern in router is the following:
beego.InsertFilter("/static/users/:userId([0-9]+)/private/*", beego.BeforeRouter, controllers.ProtectPrivateUploads)
and the filter function is the following:
var ProtectPrivateUploads = func(ctx *context.Context) {
fmt.Println("Protecting content")
}
the relevant URL has the following form:
domain.com/static/users/USERID/private/123135645.png
The problem is that the filter function does not get called at all so I am assuming that I must have done something wrong with the pattern in the router.
Any ideas would be welcomed.