actions: Allow nested and top-level actions

- Currently, privileged actions are not allowed under top-level plinth module.
They are only allowed under each app module. Allow privileged actions under
plinth module.

- Currently, privileged actions are not allowed under a sub-module of
'privileged' package. They are allowed only in 'privileged' module. Allow
sub-modules under 'privileged' package.

Tests:

- Email app functional tests pass
- Functional tests for apps using package and service privileged methods pass

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2022-10-08 18:50:34 -04:00
1 parent 74678c1d69
commit 585092ca63
4 files changed
+23 -27

No files matched your search

+5 -1
View File
@@ -59,7 +59,11 @@ def _call(module_name, action_name, arguments):
raise SyntaxError('Invalid module name')
cfg.read()
import_path = module_loader.get_module_import_path(module_name)
if module_name == 'plinth':
import_path = 'plinth'
else:
import_path = module_loader.get_module_import_path(module_name)
try:
module = importlib.import_module(import_path + '.privileged')
except ModuleNotFoundError as exception: