View Issue Details

IDProjectCategoryView StatusLast Update
15817Development RemoteControlpublic2020-02-28 10:26
Reporterollehar Assigned To 
PrioritynoneSeverityminor 
Status newResolutionopen 
Product Version4.0.0dev 
Target Version4.0.0dev 
Summary15817: Refactor remote control handler into multiple files
Description

Each command should be a separate class and file.

E.g.

class GetSessionKey extends RemoteCommand {}

When calling a remote command, it will look for a file with that name, import it and execute it.

The file is too big now, ~3k lines.

It would also improve Scrutinizer scores.

One could also add extension points for plugins this way.

And maybe use same RemoteCommands for a future REST API.

TagsNo tags attached.

Activities

ollehar

ollehar

2020-02-04 16:39

administrator   ~55703

@DenisChenu Opinion?

DenisChenu

DenisChenu

2020-02-04 16:49

developer   ~55705

My opinion : 100% for this : i think i have a dev mantis about such issue ?

One file by function , extending a basic one with session and login part ?

One could also add extension points for plugins this way.

Maybe not plugin with event, just adding files at good place :)

DenisChenu

DenisChenu

2020-02-04 16:49

developer   ~55706

Target Version :4 .X ?
Are you sure ?

DenisChenu

DenisChenu

2020-02-04 16:50

developer   ~55708

When calling a remote command, it will look for a file with that name, import it and execute it.

Only if it extend RemoteCommand and set as public (don't open public function wide)

ollehar

ollehar

2020-02-04 17:12

administrator   ~55711

Target Version :4 .X ?

We will not release any LS5 this year, if I get what I want, but instead a new minor version every quarter. Refactoring does not affect functionality, so still BC. It should be done in a separate branch and merged when stable. develop will never be unstable again. I hope... :|

ollehar

ollehar

2020-02-04 17:13

administrator   ~55712

Only if it extend RemoteCommand and set as public (don't open public function wide)

What's the possible use-case if it's NOT public?

DenisChenu

DenisChenu

2020-02-04 17:40

developer   ~55716

What's the possible use-case if it's NOT public?

I mean : don't open any function without clean system to control Devloper want to be public.

  1. Public function in controller : it's a callable by anyone with URL
  2. Public function in plugin : it's callable by another plugin or core or … but not with a simple link. See security issue . I personally add this plugin to disable this awfull function …
ollehar

ollehar

2020-02-04 17:55

administrator   ~55718

I was thinking RemoteCommand is an interface with one method: run(). If this is implemented, it's public. Everything else in that class will never be executed from the outside.

DenisChenu

DenisChenu

2020-02-04 17:56

developer   ~55719

Last edited: 2020-02-04 17:57

View 2 revisions

Great !

bismark

bismark

2020-02-26 18:20

reporter   ~56210

https://github.com/mbischof/LimeSurvey/issues/6

DenisChenu

DenisChenu

2020-02-27 14:17

developer   ~56236

@bismark quickly read your sample : need updating config for each function ?

https://github.com/mbischof/LimeSurvey/issues/6#issuecomment-559571407

I think we need a way to extend it via GUI finally ? no ?

(maybe i say dumb thing here ... )

bismark

bismark

2020-02-27 23:43

reporter   ~56246

remotecontroller defines its default methods (classes) and every new method will be defined in the config

or

you can extend remotecontroller with your own and replace it in the config with your remotecontroller

however, you have to register all mappings somewhere

DenisChenu

DenisChenu

2020-02-28 07:20

developer   ~56247

however, you have to register all mappings somewhere

Maybe we need a way to dynamically register ? Read xml like QuestionTheme or via DB ?

$remoteController = Yii::app()->getComponent('remoteController');
foreach($behaviorsToRegister as $behaviorName => $behaviorAlias) {
    $remoteController['behaviors'][$behaviorName] = $behaviorAlias;
}
Yii::app()->setComponent('remoteController',$remoteController);
DenisChenu

DenisChenu

2020-02-28 07:21

developer   ~56248

you can extend remotecontroller with your own and replace it in the config with your remotecontroller

It must be multiple time extendable, ,extendable by your "CPDB" manager and my 'ThemeManager' manager for example :)

ollehar

ollehar

2020-02-28 10:23

administrator   ~56251

I mean, if we refactor each RPC function to a separate class, it's a small deal to add an event in the file lookup logic to check if any plugin should be used instead.

DenisChenu

DenisChenu

2020-02-28 10:26

developer   ~56252

I mean, if we refactor each RPC function to a separate class, it's a small deal to add an event in the file lookup logic to check if any plugin should be used instead.

OK, right :+1:

Issue History

Date Modified Username Field Change
2020-02-04 16:39 ollehar New Issue
2020-02-04 16:39 ollehar Note Added: 55703
2020-02-04 16:39 ollehar Description Updated View Revisions
2020-02-04 16:49 ollehar Description Updated View Revisions
2020-02-04 16:49 DenisChenu Note Added: 55705
2020-02-04 16:49 DenisChenu Note Added: 55706
2020-02-04 16:50 DenisChenu Note Added: 55708
2020-02-04 17:12 ollehar Note Added: 55711
2020-02-04 17:13 ollehar Note Added: 55712
2020-02-04 17:40 DenisChenu Note Added: 55716
2020-02-04 17:55 ollehar Note Added: 55718
2020-02-04 17:56 DenisChenu Note Added: 55719
2020-02-04 17:57 DenisChenu Note Edited: 55719 View Revisions
2020-02-26 18:20 bismark Note Added: 56210
2020-02-27 14:17 DenisChenu Note Added: 56236
2020-02-27 23:43 bismark Note Added: 56246
2020-02-28 07:20 DenisChenu Note Added: 56247
2020-02-28 07:21 DenisChenu Note Added: 56248
2020-02-28 10:23 ollehar Note Added: 56251
2020-02-28 10:26 DenisChenu Note Added: 56252