summaryrefslogtreecommitdiffstats
path: root/module/Api.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-09-09 15:39:50 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-09-09 15:39:50 +0200
commit560958b70043ea5b7e0e32d41cb51bd44696d775 (patch)
tree948384effdf884301f7b4cf07ab8de95a147b600 /module/Api.py
parentlittle logo update (diff)
downloadpyload-560958b70043ea5b7e0e32d41cb51bd44696d775.tar.xz
new config api
Diffstat (limited to 'module/Api.py')
-rw-r--r--module/Api.py72
1 files changed, 42 insertions, 30 deletions
diff --git a/module/Api.py b/module/Api.py
index 4671b9cbd..d530556fa 100644
--- a/module/Api.py
+++ b/module/Api.py
@@ -123,8 +123,6 @@ class UserApi(object):
def user(self):
return self._user
-# TODO: fix permissions, user context manager
-
class Api(Iface):
"""
**pyLoads API**
@@ -263,9 +261,6 @@ class Api(Iface):
return compare_time(start, end) and self.core.config["reconnect"]["activated"]
- def scanDownloadFolder(self):
- pass
-
@RequirePerm(Permission.All)
def getProgressInfo(self):
""" Status of all currently running tasks
@@ -314,43 +309,64 @@ class Api(Iface):
def getConfig(self):
"""Retrieves complete config of core.
- :return: list of `ConfigSection`
+ :return: map of `ConfigHolder`
"""
- return dict([(section, ConfigSection(section, data.name, data.description, data.long_desc, [
+ # TODO
+ return dict([(section, ConfigHolder(section, data.name, data.description, data.long_desc, [
ConfigItem(option, d.name, d.description, d.type, to_string(d.default),
to_string(self.core.config.get(section, option))) for
option, d in data.config.iteritems()])) for
section, data in self.core.config.getBaseSections()])
- def getPluginConfig(self):
- """Retrieves complete config for all plugins.
+ def getConfigRef(self):
+ """Config instance, not for RPC"""
+ return self.core.config
+
+ def getGlobalPlugins(self):
+ """All global plugins/addons, only admin can use this
- :return: list of `ConfigSection`
+ :return: list of `ConfigInfo`
"""
- return dict([(section, ConfigSection(section,
- data.name, data.description, data.long_desc)) for
- section, data in self.core.config.getPluginSections()])
+ pass
- def configureSection(self, section):
- data = self.core.config.config[section]
- sec = ConfigSection(section, data.name, data.description, data.long_desc)
- sec.items = [ConfigItem(option, d.name, d.description,
- d.type, to_string(d.default), to_string(self.core.config.get(section, option)))
- for
- option, d in data.config.iteritems()]
+ @UserContext
+ @RequirePerm(Permission.Plugins)
+ def getUserPlugins(self):
+ """List of plugins every user can configure for himself
- #TODO: config handler
+ :return: list of `ConfigInfo`
+ """
+ pass
- return sec
+ @UserContext
+ @RequirePerm(Permission.Plugins)
+ def configurePlugin(self, plugin):
+ """Get complete config options for an plugin
+ :param plugin: Name of the plugin to configure
+ :return: :class:`ConfigHolder`
+ """
- def setConfigHandler(self, plugin, iid, value):
pass
- def getConfigRef(self):
- """Config instance, not for RPC"""
- return self.core.config
+ @UserContext
+ @RequirePerm(Permission.Plugins)
+ def saveConfig(self, config):
+ """Used to save a configuration, core config can only be saved by admins
+
+ :param config: :class:`ConfigHolder
+ """
+ pass
+
+ @UserContext
+ @RequirePerm(Permission.Plugins)
+ def deleteConfig(self, config):
+ pass
+
+ @RequirePerm(Permission.Plugins)
+ def setConfigHandler(self, plugin, iid, value):
+ pass
##########################
# Download Preparing
@@ -475,10 +491,6 @@ class Api(Iface):
in self.generatePackages(links).iteritems()]
@RequirePerm(Permission.Add)
- def autoAddLinks(self, links):
- pass
-
- @RequirePerm(Permission.Add)
def createPackage(self, name, folder, root, password="", site="", comment="", paused=False):
"""Create a new package.