mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-02 18:30:14 -06:00
fix: simplify property assignment
This commit is contained in:
@@ -82,45 +82,68 @@ type Collabora struct {
|
||||
|
||||
// SetProperties will set the file properties for the Collabora implementation.
|
||||
func (cinfo *Collabora) SetProperties(props map[string]interface{}) {
|
||||
setters := map[string]func(value interface{}){
|
||||
"BaseFileName": assignStringTo(&cinfo.BaseFileName),
|
||||
"DisablePrint": assignBoolTo(&cinfo.DisablePrint),
|
||||
"OwnerID": assignStringTo(&cinfo.OwnerID),
|
||||
"PostMessageOrigin": assignStringTo(&cinfo.PostMessageOrigin),
|
||||
"Size": assignInt64To(&cinfo.Size),
|
||||
"TemplateSource": assignStringTo(&cinfo.TemplateSource),
|
||||
"UserCanWrite": assignBoolTo(&cinfo.UserCanWrite),
|
||||
"UserCanNotWriteRelative": assignBoolTo(&cinfo.UserCanNotWriteRelative),
|
||||
"UserID": assignStringTo(&cinfo.UserID),
|
||||
"UserFriendlyName": assignStringTo(&cinfo.UserFriendlyName),
|
||||
for key, value := range props {
|
||||
switch key {
|
||||
case "BaseFileName":
|
||||
cinfo.BaseFileName = value.(string)
|
||||
case "DisablePrint":
|
||||
cinfo.DisablePrint = value.(bool)
|
||||
case "OwnerID":
|
||||
cinfo.OwnerID = value.(string)
|
||||
case "PostMessageOrigin":
|
||||
cinfo.PostMessageOrigin = value.(string)
|
||||
case "Size":
|
||||
cinfo.Size = value.(int64)
|
||||
case "TemplateSource":
|
||||
cinfo.TemplateSource = value.(string)
|
||||
case "UserCanWrite":
|
||||
cinfo.UserCanWrite = value.(bool)
|
||||
case "UserCanNotWriteRelative":
|
||||
cinfo.UserCanNotWriteRelative = value.(bool)
|
||||
case "UserID":
|
||||
cinfo.UserID = value.(string)
|
||||
case "UserFriendlyName":
|
||||
cinfo.UserFriendlyName = value.(string)
|
||||
|
||||
"EnableInsertRemoteImage": assignBoolTo(&cinfo.EnableInsertRemoteImage),
|
||||
"DisableInsertLocalImage": assignBoolTo(&cinfo.DisableInsertLocalImage),
|
||||
"HidePrintOption": assignBoolTo(&cinfo.HidePrintOption),
|
||||
"HideSaveOption": assignBoolTo(&cinfo.HideSaveOption),
|
||||
"HideExportOption": assignBoolTo(&cinfo.HideExportOption),
|
||||
"DisableExport": assignBoolTo(&cinfo.DisableExport),
|
||||
"DisableCopy": assignBoolTo(&cinfo.DisableCopy),
|
||||
"DisableInactiveMessages": assignBoolTo(&cinfo.DisableInactiveMessages),
|
||||
"DownloadAsPostMessage": assignBoolTo(&cinfo.DownloadAsPostMessage),
|
||||
"SaveAsPostmessage": assignBoolTo(&cinfo.SaveAsPostmessage),
|
||||
"EnableOwnerTermination": assignBoolTo(&cinfo.EnableOwnerTermination),
|
||||
case "EnableInsertRemoteImage":
|
||||
cinfo.EnableInsertRemoteImage = value.(bool)
|
||||
case "DisableInsertLocalImage":
|
||||
cinfo.DisableInsertLocalImage = value.(bool)
|
||||
case "HidePrintOption":
|
||||
cinfo.HidePrintOption = value.(bool)
|
||||
case "HideSaveOption":
|
||||
cinfo.HideSaveOption = value.(bool)
|
||||
case "HideExportOption":
|
||||
cinfo.HideExportOption = value.(bool)
|
||||
case "DisableExport":
|
||||
cinfo.DisableExport = value.(bool)
|
||||
case "DisableCopy":
|
||||
cinfo.DisableCopy = value.(bool)
|
||||
case "DisableInactiveMessages":
|
||||
cinfo.DisableInactiveMessages = value.(bool)
|
||||
case "DownloadAsPostMessage":
|
||||
cinfo.DownloadAsPostMessage = value.(bool)
|
||||
case "SaveAsPostmessage":
|
||||
cinfo.SaveAsPostmessage = value.(bool)
|
||||
case "EnableOwnerTermination":
|
||||
cinfo.EnableOwnerTermination = value.(bool)
|
||||
//UserExtraInfo -> requires definition, currently not used
|
||||
//UserPrivateInfo -> requires definition, currently not used
|
||||
"WatermarkText": assignStringTo(&cinfo.WatermarkText),
|
||||
case "WatermarkText":
|
||||
cinfo.WatermarkText = value.(string)
|
||||
|
||||
"EnableShare": assignBoolTo(&cinfo.EnableShare),
|
||||
"HideUserList": assignStringTo(&cinfo.HideUserList),
|
||||
"SupportsLocks": assignBoolTo(&cinfo.SupportsLocks),
|
||||
"SupportsRename": assignBoolTo(&cinfo.SupportsRename),
|
||||
"UserCanRename": assignBoolTo(&cinfo.UserCanRename),
|
||||
"BreadcrumbDocName": assignStringTo(&cinfo.BreadcrumbDocName),
|
||||
}
|
||||
|
||||
for key, value := range props {
|
||||
setterFn := setters[key]
|
||||
if setterFn != nil {
|
||||
setterFn(value)
|
||||
case "EnableShare":
|
||||
cinfo.EnableShare = value.(bool)
|
||||
case "HideUserList":
|
||||
cinfo.HideUserList = value.(string)
|
||||
case "SupportsLocks":
|
||||
cinfo.SupportsLocks = value.(bool)
|
||||
case "SupportsRename":
|
||||
cinfo.SupportsRename = value.(bool)
|
||||
case "UserCanRename":
|
||||
cinfo.UserCanRename = value.(bool)
|
||||
case "BreadcrumbDocName":
|
||||
cinfo.BreadcrumbDocName = value.(string)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,80 +24,3 @@ type FileInfo interface {
|
||||
// Note that the returned value must be unique among all the implementations
|
||||
GetTarget() string
|
||||
}
|
||||
|
||||
// assignStringTo will return a function whose parameter will be assigned
|
||||
// to the provided key. The function will panic if the assignment isn't
|
||||
// possible.
|
||||
//
|
||||
// fn := AssignStringTo(&target)
|
||||
// fn(value)
|
||||
//
|
||||
// Is roughly equivalent to
|
||||
//
|
||||
// target = value
|
||||
//
|
||||
// The reason for this method is to help the `SetProperties` method in order
|
||||
// to provide a setter function for each property.
|
||||
// Expected code for the `SetProperties` should be similar to
|
||||
//
|
||||
// setters := map[string]func(value interface{}) {
|
||||
// "Owner": AssignStringTo(&info.Owner),
|
||||
// "DisplayName": AssignStringTo(&info.DisplayName),
|
||||
// .....
|
||||
// }
|
||||
// for key, value := range props {
|
||||
// fn := setters[key]
|
||||
// fn(value)
|
||||
// }
|
||||
//
|
||||
// Further `assign*To` functions will be provided to be able to assign
|
||||
// different data types
|
||||
func assignStringTo(targetKey *string) func(value interface{}) {
|
||||
return func(value interface{}) {
|
||||
*targetKey = value.(string)
|
||||
}
|
||||
}
|
||||
|
||||
// assignStringListTo will return a function whose parameter will be assigned
|
||||
// to the provided key. The function will panic if the assignment isn't
|
||||
// possible.
|
||||
//
|
||||
// See assignStringTo for more information
|
||||
func assignStringListTo(targetKey *[]string) func(value interface{}) {
|
||||
return func(value interface{}) {
|
||||
*targetKey = value.([]string)
|
||||
}
|
||||
}
|
||||
|
||||
// assignInt64To will return a function whose parameter will be assigned
|
||||
// to the provided key. The function will panic if the assignment isn't
|
||||
// possible.
|
||||
//
|
||||
// See assignStringTo for more information
|
||||
func assignInt64To(targetKey *int64) func(value interface{}) {
|
||||
return func(value interface{}) {
|
||||
*targetKey = value.(int64)
|
||||
}
|
||||
}
|
||||
|
||||
// assignIntTo will return a function whose parameter will be assigned
|
||||
// to the provided key. The function will panic if the assignment isn't
|
||||
// possible.
|
||||
//
|
||||
// See assignStringTo for more information
|
||||
func assignIntTo(targetKey *int) func(value interface{}) {
|
||||
return func(value interface{}) {
|
||||
*targetKey = value.(int)
|
||||
}
|
||||
}
|
||||
|
||||
// assignBoolTo will return a function whose parameter will be assigned
|
||||
// to the provided key. The function will panic if the assignment isn't
|
||||
// possible.
|
||||
//
|
||||
// See assignStringTo for more information
|
||||
func assignBoolTo(targetKey *bool) func(value interface{}) {
|
||||
return func(value interface{}) {
|
||||
*targetKey = value.(bool)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,79 +165,133 @@ type Microsoft struct {
|
||||
|
||||
// SetProperties will set the file properties for the Microsoft implementation.
|
||||
func (minfo *Microsoft) SetProperties(props map[string]interface{}) {
|
||||
setters := map[string]func(value interface{}){
|
||||
"BaseFileName": assignStringTo(&minfo.BaseFileName),
|
||||
"OwnerID": assignStringTo(&minfo.OwnerID),
|
||||
"Size": assignInt64To(&minfo.Size),
|
||||
"UserID": assignStringTo(&minfo.UserID),
|
||||
"Version": assignStringTo(&minfo.Version),
|
||||
|
||||
"SupportedShareURLTypes": assignStringListTo(&minfo.SupportedShareURLTypes),
|
||||
"SupportsCobalt": assignBoolTo(&minfo.SupportsCobalt),
|
||||
"SupportsContainers": assignBoolTo(&minfo.SupportsContainers),
|
||||
"SupportsDeleteFile": assignBoolTo(&minfo.SupportsDeleteFile),
|
||||
"SupportsEcosystem": assignBoolTo(&minfo.SupportsEcosystem),
|
||||
"SupportsExtendedLockLength": assignBoolTo(&minfo.SupportsExtendedLockLength),
|
||||
"SupportsFolders": assignBoolTo(&minfo.SupportsFolders),
|
||||
//SupportsGetFileWopiSrc bool `json:"SupportsGetFileWopiSrc"` // wopivalidator is complaining and the property isn't used for now -> commented
|
||||
"SupportsGetLock": assignBoolTo(&minfo.SupportsGetLock),
|
||||
"SupportsLocks": assignBoolTo(&minfo.SupportsLocks),
|
||||
"SupportsRename": assignBoolTo(&minfo.SupportsRename),
|
||||
"SupportsUpdate": assignBoolTo(&minfo.SupportsUpdate),
|
||||
"SupportsUserInfo": assignBoolTo(&minfo.SupportsUserInfo),
|
||||
|
||||
"IsAnonymousUser": assignBoolTo(&minfo.IsAnonymousUser),
|
||||
"IsEduUser": assignBoolTo(&minfo.IsEduUser),
|
||||
"LicenseCheckForEditIsEnabled": assignBoolTo(&minfo.LicenseCheckForEditIsEnabled),
|
||||
"UserFriendlyName": assignStringTo(&minfo.UserFriendlyName),
|
||||
"UserInfo": assignStringTo(&minfo.UserInfo),
|
||||
|
||||
"ReadOnly": assignBoolTo(&minfo.ReadOnly),
|
||||
"RestrictedWebViewOnly": assignBoolTo(&minfo.RestrictedWebViewOnly),
|
||||
"UserCanAttend": assignBoolTo(&minfo.UserCanAttend),
|
||||
"UserCanNotWriteRelative": assignBoolTo(&minfo.UserCanNotWriteRelative),
|
||||
"UserCanPresent": assignBoolTo(&minfo.UserCanPresent),
|
||||
"UserCanRename": assignBoolTo(&minfo.UserCanRename),
|
||||
"UserCanWrite": assignBoolTo(&minfo.UserCanWrite),
|
||||
|
||||
"CloseURL": assignStringTo(&minfo.CloseURL),
|
||||
"DownloadURL": assignStringTo(&minfo.DownloadURL),
|
||||
"FileEmbedCommandURL": assignStringTo(&minfo.FileEmbedCommandURL),
|
||||
"FileSharingURL": assignStringTo(&minfo.FileSharingURL),
|
||||
"FileURL": assignStringTo(&minfo.FileURL),
|
||||
"FileVersionURL": assignStringTo(&minfo.FileVersionURL),
|
||||
"HostEditURL": assignStringTo(&minfo.HostEditURL),
|
||||
"HostEmbeddedViewURL": assignStringTo(&minfo.HostEmbeddedViewURL),
|
||||
"HostViewURL": assignStringTo(&minfo.HostViewURL),
|
||||
"SignoutURL": assignStringTo(&minfo.SignoutURL),
|
||||
|
||||
"AllowAdditionalMicrosoftServices": assignBoolTo(&minfo.AllowAdditionalMicrosoftServices),
|
||||
"AllowErrorReportPrompt": assignBoolTo(&minfo.AllowErrorReportPrompt),
|
||||
"AllowExternalMarketplace": assignBoolTo(&minfo.AllowExternalMarketplace),
|
||||
"ClientThrottlingProtection": assignStringTo(&minfo.ClientThrottlingProtection),
|
||||
"CloseButtonClosesWindow": assignBoolTo(&minfo.CloseButtonClosesWindow),
|
||||
"CopyPasteRestrictions": assignStringTo(&minfo.CopyPasteRestrictions),
|
||||
"DisablePrint": assignBoolTo(&minfo.DisablePrint),
|
||||
"DisableTranslation": assignBoolTo(&minfo.DisableTranslation),
|
||||
"FileExtension": assignStringTo(&minfo.FileExtension),
|
||||
"FileNameMaxLength": assignIntTo(&minfo.FileNameMaxLength),
|
||||
"LastModifiedTime": assignStringTo(&minfo.LastModifiedTime),
|
||||
"RequestedCallThrottling": assignStringTo(&minfo.RequestedCallThrottling),
|
||||
"SHA256": assignStringTo(&minfo.SHA256),
|
||||
"SharingStatus": assignStringTo(&minfo.SharingStatus),
|
||||
"TemporarilyNotWritable": assignBoolTo(&minfo.TemporarilyNotWritable),
|
||||
|
||||
"BreadcrumbBrandName": assignStringTo(&minfo.BreadcrumbBrandName),
|
||||
"BreadcrumbBrandURL": assignStringTo(&minfo.BreadcrumbBrandURL),
|
||||
"BreadcrumbDocName": assignStringTo(&minfo.BreadcrumbDocName),
|
||||
"BreadcrumbFolderName": assignStringTo(&minfo.BreadcrumbFolderName),
|
||||
"BreadcrumbFolderURL": assignStringTo(&minfo.BreadcrumbFolderURL),
|
||||
}
|
||||
|
||||
for key, value := range props {
|
||||
setterFn := setters[key]
|
||||
if setterFn != nil {
|
||||
setterFn(value)
|
||||
switch key {
|
||||
case "BaseFileName":
|
||||
minfo.BaseFileName = value.(string)
|
||||
case "OwnerID":
|
||||
minfo.OwnerID = value.(string)
|
||||
case "Size":
|
||||
minfo.Size = value.(int64)
|
||||
case "UserID":
|
||||
minfo.UserID = value.(string)
|
||||
case "Version":
|
||||
minfo.Version = value.(string)
|
||||
|
||||
case "SupportedShareURLTypes":
|
||||
minfo.SupportedShareURLTypes = value.([]string)
|
||||
case "SupportsCobalt":
|
||||
minfo.SupportsCobalt = value.(bool)
|
||||
case "SupportsContainers":
|
||||
minfo.SupportsContainers = value.(bool)
|
||||
case "SupportsDeleteFile":
|
||||
minfo.SupportsDeleteFile = value.(bool)
|
||||
case "SupportsEcosystem":
|
||||
minfo.SupportsEcosystem = value.(bool)
|
||||
case "SupportsExtendedLockLength":
|
||||
minfo.SupportsExtendedLockLength = value.(bool)
|
||||
case "SupportsFolders":
|
||||
minfo.SupportsFolders = value.(bool)
|
||||
//SupportsGetFileWopiSrc bool `json:"SupportsGetFileWopiSrc"` // wopivalidator is complaining and the property isn't used for now -> commented
|
||||
case "SupportsGetLock":
|
||||
minfo.SupportsGetLock = value.(bool)
|
||||
case "SupportsLocks":
|
||||
minfo.SupportsLocks = value.(bool)
|
||||
case "SupportsRename":
|
||||
minfo.SupportsRename = value.(bool)
|
||||
case "SupportsUpdate":
|
||||
minfo.SupportsUpdate = value.(bool)
|
||||
case "SupportsUserInfo":
|
||||
minfo.SupportsUserInfo = value.(bool)
|
||||
|
||||
case "IsAnonymousUser":
|
||||
minfo.IsAnonymousUser = value.(bool)
|
||||
case "IsEduUser":
|
||||
minfo.IsEduUser = value.(bool)
|
||||
case "LicenseCheckForEditIsEnabled":
|
||||
minfo.LicenseCheckForEditIsEnabled = value.(bool)
|
||||
case "UserFriendlyName":
|
||||
minfo.UserFriendlyName = value.(string)
|
||||
case "UserInfo":
|
||||
minfo.UserInfo = value.(string)
|
||||
|
||||
case "ReadOnly":
|
||||
minfo.ReadOnly = value.(bool)
|
||||
case "RestrictedWebViewOnly":
|
||||
minfo.RestrictedWebViewOnly = value.(bool)
|
||||
case "UserCanAttend":
|
||||
minfo.UserCanAttend = value.(bool)
|
||||
case "UserCanNotWriteRelative":
|
||||
minfo.UserCanNotWriteRelative = value.(bool)
|
||||
case "UserCanPresent":
|
||||
minfo.UserCanPresent = value.(bool)
|
||||
case "UserCanRename":
|
||||
minfo.UserCanRename = value.(bool)
|
||||
case "UserCanWrite":
|
||||
minfo.UserCanWrite = value.(bool)
|
||||
|
||||
case "CloseURL":
|
||||
minfo.CloseURL = value.(string)
|
||||
case "DownloadURL":
|
||||
minfo.DownloadURL = value.(string)
|
||||
case "FileEmbedCommandURL":
|
||||
minfo.FileEmbedCommandURL = value.(string)
|
||||
case "FileSharingURL":
|
||||
minfo.FileSharingURL = value.(string)
|
||||
case "FileURL":
|
||||
minfo.FileURL = value.(string)
|
||||
case "FileVersionURL":
|
||||
minfo.FileVersionURL = value.(string)
|
||||
case "HostEditURL":
|
||||
minfo.HostEditURL = value.(string)
|
||||
case "HostEmbeddedViewURL":
|
||||
minfo.HostEmbeddedViewURL = value.(string)
|
||||
case "HostViewURL":
|
||||
minfo.HostViewURL = value.(string)
|
||||
case "SignoutURL":
|
||||
minfo.SignoutURL = value.(string)
|
||||
|
||||
case "AllowAdditionalMicrosoftServices":
|
||||
minfo.AllowAdditionalMicrosoftServices = value.(bool)
|
||||
case "AllowErrorReportPrompt":
|
||||
minfo.AllowErrorReportPrompt = value.(bool)
|
||||
case "AllowExternalMarketplace":
|
||||
minfo.AllowExternalMarketplace = value.(bool)
|
||||
case "ClientThrottlingProtection":
|
||||
minfo.ClientThrottlingProtection = value.(string)
|
||||
case "CloseButtonClosesWindow":
|
||||
minfo.CloseButtonClosesWindow = value.(bool)
|
||||
case "CopyPasteRestrictions":
|
||||
minfo.CopyPasteRestrictions = value.(string)
|
||||
case "DisablePrint":
|
||||
minfo.DisablePrint = value.(bool)
|
||||
case "DisableTranslation":
|
||||
minfo.DisableTranslation = value.(bool)
|
||||
case "FileExtension":
|
||||
minfo.FileExtension = value.(string)
|
||||
case "FileNameMaxLength":
|
||||
minfo.FileNameMaxLength = value.(int)
|
||||
case "LastModifiedTime":
|
||||
minfo.LastModifiedTime = value.(string)
|
||||
case "RequestedCallThrottling":
|
||||
minfo.RequestedCallThrottling = value.(string)
|
||||
case "SHA256":
|
||||
minfo.SHA256 = value.(string)
|
||||
case "SharingStatus":
|
||||
minfo.SharingStatus = value.(string)
|
||||
case "TemporarilyNotWritable":
|
||||
minfo.TemporarilyNotWritable = value.(bool)
|
||||
|
||||
case "BreadcrumbBrandName":
|
||||
minfo.BreadcrumbBrandName = value.(string)
|
||||
case "BreadcrumbBrandURL":
|
||||
minfo.BreadcrumbBrandURL = value.(string)
|
||||
case "BreadcrumbDocName":
|
||||
minfo.BreadcrumbDocName = value.(string)
|
||||
case "BreadcrumbFolderName":
|
||||
minfo.BreadcrumbFolderName = value.(string)
|
||||
case "BreadcrumbFolderURL":
|
||||
minfo.BreadcrumbFolderURL = value.(string)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,57 +129,88 @@ type OnlyOffice struct {
|
||||
|
||||
// SetProperties will set the file properties for the OnlyOffice implementation.
|
||||
func (oinfo *OnlyOffice) SetProperties(props map[string]interface{}) {
|
||||
setters := map[string]func(value interface{}){
|
||||
"BaseFileName": assignStringTo(&oinfo.BaseFileName),
|
||||
"Version": assignStringTo(&oinfo.Version),
|
||||
|
||||
"BreadcrumbBrandName": assignStringTo(&oinfo.BreadcrumbBrandName),
|
||||
"BreadcrumbBrandURL": assignStringTo(&oinfo.BreadcrumbBrandURL),
|
||||
"BreadcrumbDocName": assignStringTo(&oinfo.BreadcrumbDocName),
|
||||
"BreadcrumbFolderName": assignStringTo(&oinfo.BreadcrumbFolderName),
|
||||
"BreadcrumbFolderURL": assignStringTo(&oinfo.BreadcrumbFolderURL),
|
||||
|
||||
"ClosePostMessage": assignBoolTo(&oinfo.ClosePostMessage),
|
||||
"EditModePostMessage": assignBoolTo(&oinfo.EditModePostMessage),
|
||||
"EditNotificationPostMessage": assignBoolTo(&oinfo.EditNotificationPostMessage),
|
||||
"FileSharingPostMessage": assignBoolTo(&oinfo.FileSharingPostMessage),
|
||||
"FileVersionPostMessage": assignBoolTo(&oinfo.FileVersionPostMessage),
|
||||
"PostMessageOrigin": assignStringTo(&oinfo.PostMessageOrigin),
|
||||
|
||||
"CloseURL": assignStringTo(&oinfo.CloseURL),
|
||||
"FileSharingURL": assignStringTo(&oinfo.FileSharingURL),
|
||||
"FileVersionURL": assignStringTo(&oinfo.FileVersionURL),
|
||||
"HostEditURL": assignStringTo(&oinfo.HostEditURL),
|
||||
|
||||
"CopyPasteRestrictions": assignStringTo(&oinfo.CopyPasteRestrictions),
|
||||
"DisablePrint": assignBoolTo(&oinfo.DisablePrint),
|
||||
"FileExtension": assignStringTo(&oinfo.FileExtension),
|
||||
"FileNameMaxLength": assignIntTo(&oinfo.FileNameMaxLength),
|
||||
"LastModifiedTime": assignStringTo(&oinfo.LastModifiedTime),
|
||||
|
||||
"IsAnonymousUser": assignBoolTo(&oinfo.IsAnonymousUser),
|
||||
"UserFriendlyName": assignStringTo(&oinfo.UserFriendlyName),
|
||||
"UserID": assignStringTo(&oinfo.UserID),
|
||||
|
||||
"ReadOnly": assignBoolTo(&oinfo.ReadOnly),
|
||||
"UserCanNotWriteRelative": assignBoolTo(&oinfo.UserCanNotWriteRelative),
|
||||
"UserCanRename": assignBoolTo(&oinfo.UserCanRename),
|
||||
"UserCanReview": assignBoolTo(&oinfo.UserCanReview),
|
||||
"UserCanWrite": assignBoolTo(&oinfo.UserCanWrite),
|
||||
|
||||
"SupportsLocks": assignBoolTo(&oinfo.SupportsLocks),
|
||||
"SupportsRename": assignBoolTo(&oinfo.SupportsRename),
|
||||
"SupportsReviewing": assignBoolTo(&oinfo.SupportsReviewing),
|
||||
"SupportsUpdate": assignBoolTo(&oinfo.SupportsUpdate),
|
||||
|
||||
"EnableInsertRemoteImage": assignBoolTo(&oinfo.EnableInsertRemoteImage),
|
||||
"HidePrintOption": assignBoolTo(&oinfo.HidePrintOption),
|
||||
}
|
||||
|
||||
for key, value := range props {
|
||||
setterFn := setters[key]
|
||||
if setterFn != nil {
|
||||
setterFn(value)
|
||||
switch key {
|
||||
case "BaseFileName":
|
||||
oinfo.BaseFileName = value.(string)
|
||||
case "Version":
|
||||
oinfo.Version = value.(string)
|
||||
|
||||
case "BreadcrumbBrandName":
|
||||
oinfo.BreadcrumbBrandName = value.(string)
|
||||
case "BreadcrumbBrandURL":
|
||||
oinfo.BreadcrumbBrandURL = value.(string)
|
||||
case "BreadcrumbDocName":
|
||||
oinfo.BreadcrumbDocName = value.(string)
|
||||
case "BreadcrumbFolderName":
|
||||
oinfo.BreadcrumbFolderName = value.(string)
|
||||
case "BreadcrumbFolderURL":
|
||||
oinfo.BreadcrumbFolderURL = value.(string)
|
||||
|
||||
case "ClosePostMessage":
|
||||
oinfo.ClosePostMessage = value.(bool)
|
||||
case "EditModePostMessage":
|
||||
oinfo.EditModePostMessage = value.(bool)
|
||||
case "EditNotificationPostMessage":
|
||||
oinfo.EditNotificationPostMessage = value.(bool)
|
||||
case "FileSharingPostMessage":
|
||||
oinfo.FileSharingPostMessage = value.(bool)
|
||||
case "FileVersionPostMessage":
|
||||
oinfo.FileVersionPostMessage = value.(bool)
|
||||
case "PostMessageOrigin":
|
||||
oinfo.PostMessageOrigin = value.(string)
|
||||
|
||||
case "CloseURL":
|
||||
oinfo.CloseURL = value.(string)
|
||||
case "FileSharingURL":
|
||||
oinfo.FileSharingURL = value.(string)
|
||||
case "FileVersionURL":
|
||||
oinfo.FileVersionURL = value.(string)
|
||||
case "HostEditURL":
|
||||
oinfo.HostEditURL = value.(string)
|
||||
|
||||
case "CopyPasteRestrictions":
|
||||
oinfo.CopyPasteRestrictions = value.(string)
|
||||
case "DisablePrint":
|
||||
oinfo.DisablePrint = value.(bool)
|
||||
case "FileExtension":
|
||||
oinfo.FileExtension = value.(string)
|
||||
case "FileNameMaxLength":
|
||||
oinfo.FileNameMaxLength = value.(int)
|
||||
case "LastModifiedTime":
|
||||
oinfo.LastModifiedTime = value.(string)
|
||||
|
||||
case "IsAnonymousUser":
|
||||
oinfo.IsAnonymousUser = value.(bool)
|
||||
case "UserFriendlyName":
|
||||
oinfo.UserFriendlyName = value.(string)
|
||||
case "UserID":
|
||||
oinfo.UserID = value.(string)
|
||||
|
||||
case "ReadOnly":
|
||||
oinfo.ReadOnly = value.(bool)
|
||||
case "UserCanNotWriteRelative":
|
||||
oinfo.UserCanNotWriteRelative = value.(bool)
|
||||
case "UserCanRename":
|
||||
oinfo.UserCanRename = value.(bool)
|
||||
case "UserCanReview":
|
||||
oinfo.UserCanReview = value.(bool)
|
||||
case "UserCanWrite":
|
||||
oinfo.UserCanWrite = value.(bool)
|
||||
|
||||
case "SupportsLocks":
|
||||
oinfo.SupportsLocks = value.(bool)
|
||||
case "SupportsRename":
|
||||
oinfo.SupportsRename = value.(bool)
|
||||
case "SupportsReviewing":
|
||||
oinfo.SupportsReviewing = value.(bool)
|
||||
case "SupportsUpdate":
|
||||
oinfo.SupportsUpdate = value.(bool)
|
||||
|
||||
case "EnableInsertRemoteImage":
|
||||
oinfo.EnableInsertRemoteImage = value.(bool)
|
||||
case "HidePrintOption":
|
||||
oinfo.HidePrintOption = value.(bool)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user