basic ideas
This commit is contained in:
parent
154ddfe5e0
commit
c943e1b0e7
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
package models
|
package models
|
||||||
|
|
||||||
|
import "code.vikunja.io/web"
|
||||||
|
|
||||||
type SharingType int
|
type SharingType int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -25,6 +27,17 @@ const (
|
||||||
SharingTypeWithPassword
|
SharingTypeWithPassword
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
General Idea:
|
||||||
|
* We have the usual get/create/delete stuff behind the web handler, same procedure as everywhere
|
||||||
|
* These routes are behind jwt token auth
|
||||||
|
* One needs at least write access to a list to be able to share it via a link -> Document that somewhere!
|
||||||
|
* Then we have a second struct which has "hash" and thats it. Maybe with a pointer to the list in it.
|
||||||
|
* We then have the usual CRUD-Routes on a list, with a different set of routes and using a different handler.
|
||||||
|
* Through that other routes and handler, the handler checks if the hash exists and if it requires a password.
|
||||||
|
* It then passes the request on directly to the actual CRUD implementation of the list, but without their right checks.
|
||||||
|
*/
|
||||||
|
|
||||||
type LinkSharing struct {
|
type LinkSharing struct {
|
||||||
// The ID of the shared thing
|
// The ID of the shared thing
|
||||||
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
|
ID int64 `xorm:"int(11) autoincr not null unique pk" json:"id"`
|
||||||
|
@ -48,4 +61,7 @@ type LinkSharing struct {
|
||||||
Created int64 `xorm:"created not null" json:"created"`
|
Created int64 `xorm:"created not null" json:"created"`
|
||||||
// A unix timestamp when this share was last updated. You cannot change this value.
|
// A unix timestamp when this share was last updated. You cannot change this value.
|
||||||
Updated int64 `xorm:"updated not null" json:"updated"`
|
Updated int64 `xorm:"updated not null" json:"updated"`
|
||||||
|
|
||||||
|
web.CRUDable `xorm:"-" json:"-"`
|
||||||
|
web.Rights `xorm:"-" json:"-"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,6 +194,17 @@ func registerAPIRoutes(a *echo.Group) {
|
||||||
a.PUT("/namespaces/:namespace/lists", listHandler.CreateWeb)
|
a.PUT("/namespaces/:namespace/lists", listHandler.CreateWeb)
|
||||||
a.GET("/lists/:list/listusers", apiv1.ListUsersForList)
|
a.GET("/lists/:list/listusers", apiv1.ListUsersForList)
|
||||||
|
|
||||||
|
listSharingHandler := &handler.WebHandler{
|
||||||
|
EmptyStruct: func() handler.CObject {
|
||||||
|
return &models.LinkSharing{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
a.PUT("/lists/:list/shares/new", listSharingHandler.CreateWeb)
|
||||||
|
a.GET("/lists/:list/shares", listSharingHandler.ReadAllWeb)
|
||||||
|
a.GET("/lists/:list/shares/:hash", listSharingHandler.ReadOneWeb)
|
||||||
|
a.DELETE("/lists/:list/shares/:hash", listSharingHandler.DeleteWeb)
|
||||||
|
|
||||||
taskHandler := &handler.WebHandler{
|
taskHandler := &handler.WebHandler{
|
||||||
EmptyStruct: func() handler.CObject {
|
EmptyStruct: func() handler.CObject {
|
||||||
return &models.Task{}
|
return &models.Task{}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user