Git Product home page Git Product logo

cs3-wopi-server's People

Contributors

deepdiver1975 avatar wkloucek avatar

Watchers

 avatar  avatar

cs3-wopi-server's Issues

rename

case "RENAME_FILE":
// https://docs.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/renamefile
http.Error(w, http.StatusText(http.StatusNotImplemented), http.StatusNotImplemented)

un- and relock

// Lock returns a WOPI lock or performs an unlock and relock
// https://docs.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/lock
// https://docs.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/unlockandrelock
func Lock(app *demoApp, w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
wopiContext, _ := WopiContextFromCtx(ctx)
// TODO: handle un- and relock

refresh lock logic

// RefreshLock refreshes a provided lock for 30 minutes
// https://docs.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/refreshlock
func RefreshLock(app *demoApp, w http.ResponseWriter, r *http.Request) {
// TODO: implement
http.Error(w, http.StatusText(http.StatusNotImplemented), http.StatusNotImplemented)
}

configurable log levels

// LoggerFromConfig initializes a service-specific logger instance.
func Configure(name string) log.Logger {
return log.NewLogger(
log.Name(name),
log.Level("debug"), // TODO: this should be configurable
log.Pretty(true), // TODO: this should be configurable
log.Color(true), // TODO: this should be configurable
log.File(""), // TODO: this should be configurable
)
}

file ids in logs

Every WOPI requests is based on a file. We should therefore always include file ids in our logs. That would be really helpful for debugging purposes / log investigation on production systems.

lock used as refreshlock

if resp.Lock != nil {
if resp.Lock.LockId != lockID {
w.Header().Set(HeaderWopiLock, resp.Lock.LockId)
http.Error(w, http.StatusText(http.StatusConflict), http.StatusConflict)
return
}
// TODO: according to the spec we need to treat this as a RefreshLock
http.Error(w, http.StatusText(http.StatusOK), http.StatusOK)
return
}

OnlyOffice specific settings

check user logic

// user logic from reva wopi driver #TODO: refactor
var isPublicShare bool = false
if wopiContext.User != nil {
if wopiContext.User.Id.Type == userv1beta1.UserType_USER_TYPE_LIGHTWEIGHT {
fileInfo.UserID = statRes.Info.Owner.OpaqueId + "@" + statRes.Info.Owner.Idp
} else {
fileInfo.UserID = wopiContext.User.Id.OpaqueId + "@" + wopiContext.User.Id.Idp
}
if wopiContext.User.Opaque != nil {
if _, ok := wopiContext.User.Opaque.Map["public-share-role"]; ok {
isPublicShare = true
}
}
if !isPublicShare {
fileInfo.UserFriendlyName = wopiContext.User.Username
fileInfo.UserID = wopiContext.User.Id.OpaqueId + "@" + wopiContext.User.Id.Idp
}
}
if wopiContext.User == nil || isPublicShare {
randomID, _ := uuid.NewUUID()
fileInfo.UserID = "guest-" + randomID.String()
fileInfo.UserFriendlyName = "Guest " + randomID.String()
fileInfo.IsAnonymousUser = true
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.