MCPcopy Create free account
hub / github.com/pydio/cells / PluginConfig

Method PluginConfig

common/service/frontend/plugin.go:313–359  ·  view source on GitHub ↗
(status RequestStatus, param *Cglobal_param)

Source from the content-addressed store, hash-verified

311}
312
313func (plugin *Cplugin) PluginConfig(status RequestStatus, param *Cglobal_param) interface{} {
314
315 var val interface{}
316
317 switch param.Attrtype {
318 case "boolean":
319 var e error
320 val, e = strconv.ParseBool(param.Attrdefault)
321 if e != nil {
322 val = false
323 }
324
325 // First we look in the main config
326 val = status.Config.Val(config.FrontendPluginPath(plugin.GetId(), param.Attrname)...).Default(val).Bool()
327
328 // Then we lookin foreach scope and get the last one set
329 for _, scope := range status.WsScopes {
330 val = status.AclParameters.Val(plugin.GetId(), param.Attrname, scope).Default(val).Bool()
331 }
332 case "integer":
333 var e error
334 val, e = strconv.ParseInt(param.Attrdefault, 10, 32)
335 if e != nil {
336 val = 0
337 }
338
339 // First we look in the main config
340 val = status.Config.Val(config.FrontendPluginPath(plugin.GetId(), param.Attrname)...).Default(val).Int()
341
342 // Then we lookin foreach scope and get the last one set
343 for _, scope := range status.WsScopes {
344 val = status.AclParameters.Val(plugin.GetId(), param.Attrname, scope).Default(val).Int()
345 }
346 default:
347 val = param.Attrdefault
348
349 // First we look in the main config
350 val = status.Config.Val(config.FrontendPluginPath(plugin.GetId(), param.Attrname)...).Default(val).String()
351
352 // Then we lookin foreach scope and get the last one set
353 for _, scope := range status.WsScopes {
354 val = status.AclParameters.Val(plugin.GetId(), param.Attrname, scope).Default(val).String()
355 }
356 }
357
358 return val
359}

Callers 2

PluginConfigsMethod · 0.95

Calls 7

GetIdMethod · 0.95
FrontendPluginPathFunction · 0.92
BoolMethod · 0.65
DefaultMethod · 0.65
ValMethod · 0.65
IntMethod · 0.65
StringMethod · 0.65

Tested by 1