diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-05-07 18:42:29 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-05-07 18:42:29 +0200 |
commit | 84efa9d5ccd46a0adddc256a5eba4f8e33c76afd (patch) | |
tree | 054dbc3c628fed88acc4abfb92523c7eee171d39 /module/remote | |
parent | some classes for multi user mode (diff) | |
download | pyload-84efa9d5ccd46a0adddc256a5eba4f8e33c76afd.tar.xz |
new multiuser api methods
Diffstat (limited to 'module/remote')
-rw-r--r-- | module/remote/socketbackend/ttypes.py | 41 | ||||
-rw-r--r-- | module/remote/thriftbackend/pyload.thrift | 83 | ||||
-rwxr-xr-x | module/remote/thriftbackend/thriftgen/pyload/Pyload-remote | 44 | ||||
-rw-r--r-- | module/remote/thriftbackend/thriftgen/pyload/Pyload.py | 364 | ||||
-rw-r--r-- | module/remote/thriftbackend/thriftgen/pyload/ttypes.py | 108 |
5 files changed, 562 insertions, 78 deletions
diff --git a/module/remote/socketbackend/ttypes.py b/module/remote/socketbackend/ttypes.py index 1fd61ae72..36f2b01ef 100644 --- a/module/remote/socketbackend/ttypes.py +++ b/module/remote/socketbackend/ttypes.py @@ -62,18 +62,36 @@ class PackageStatus: Paused = 1 Remote = 2 +class Permission: + Accounts = 128 + Add = 1 + Addons = 512 + All = 0 + Delete = 2 + Download = 64 + Interaction = 256 + List = 16 + Modify = 32 + Status = 4 + +class Role: + Admin = 0 + User = 1 + class AccountInfo(BaseObject): - __slots__ = ['plugin', 'loginname', 'valid', 'validuntil', 'trafficleft', 'maxtraffic', 'premium', 'activated', 'options'] + __slots__ = ['plugin', 'loginname', 'owner', 'valid', 'validuntil', 'trafficleft', 'maxtraffic', 'premium', 'activated', 'shared', 'options'] - def __init__(self, plugin=None, loginname=None, valid=None, validuntil=None, trafficleft=None, maxtraffic=None, premium=None, activated=None, options=None): + def __init__(self, plugin=None, loginname=None, owner=None, valid=None, validuntil=None, trafficleft=None, maxtraffic=None, premium=None, activated=None, shared=None, options=None): self.plugin = plugin self.loginname = loginname + self.owner = owner self.valid = valid self.validuntil = validuntil self.trafficleft = trafficleft self.maxtraffic = maxtraffic self.premium = premium self.activated = activated + self.shared = shared self.options = options class AddonInfo(BaseObject): @@ -273,13 +291,18 @@ class ServiceException(Exception): self.msg = msg class UserData(BaseObject): - __slots__ = ['name', 'email', 'role', 'permission', 'templateName'] + __slots__ = ['uid', 'name', 'email', 'role', 'permission', 'folder', 'traffic', 'limit', 'user', 'templateName'] - def __init__(self, name=None, email=None, role=None, permission=None, templateName=None): + def __init__(self, uid=None, name=None, email=None, role=None, permission=None, folder=None, traffic=None, limit=None, user=None, templateName=None): + self.uid = uid self.name = name self.email = email self.role = role self.permission = permission + self.folder = folder + self.traffic = traffic + self.limit = limit + self.user = user self.templateName = templateName class UserDoesNotExists(Exception): @@ -301,6 +324,8 @@ class Iface: pass def addToCollector(self, links): pass + def addUser(self, username, password): + pass def autoAddLinks(self, links): pass def call(self, plugin, func, arguments): @@ -383,7 +408,7 @@ class Iface: pass def getUnfinishedFileTree(self, pid, full): pass - def getUserData(self, username, password): + def getUserData(self): pass def hasService(self, plugin, func): pass @@ -415,6 +440,8 @@ class Iface: pass def removeAccount(self, plugin, account): pass + def removeUser(self, uid): + pass def renameCollPack(self, name, new_name): pass def restart(self): @@ -441,6 +468,8 @@ class Iface: pass def setPackagePaused(self, pid, paused): pass + def setPassword(self, username, old_password, new_password): + pass def statusServer(self): pass def stopAllDownloads(self): @@ -455,6 +484,8 @@ class Iface: pass def updateAccount(self, plugin, account, password, options): pass + def updateUserData(self, data): + pass def uploadContainer(self, filename, data): pass diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift index df82dae2d..254f41068 100644 --- a/module/remote/thriftbackend/pyload.thrift +++ b/module/remote/thriftbackend/pyload.thrift @@ -4,12 +4,12 @@ typedef i32 FileID typedef i32 PackageID typedef i32 ResultID typedef i32 InteractionID +typedef i32 UserID typedef i64 UTCDate typedef i64 ByteCount typedef list<string> LinkList -// a string that can represent multiple types int, bool, time, etc.. -typedef string ValueString typedef string PluginName +typedef string JSONString // NA - Not Available enum DownloadStatus { @@ -80,6 +80,24 @@ enum Output { Query = 4, } +enum Permission { + All = 0, // requires no permission, but login + Add = 1, // can add packages + Delete = 2, // can delete packages + Status = 4, // see and change server status + List = 16, // see listed downloads + Modify = 32, // modify some attribute of downloads + Download = 64, // can download from webinterface + Accounts = 128, // can access accounts + Interaction = 256, // can interact with plugins + Addons = 512 // user can activate addons +} + +enum Role { + Admin = 0, //admin has all permissions implicit + User = 1 +} + struct ProgressInfo { 1: FileID fid, 2: string name, @@ -176,7 +194,7 @@ struct InteractionTask { 2: Input input, 3: list<string> data, 4: Output output, - 5: optional ValueString default_value, + 5: optional JSONString default_value, 6: string title, 7: string description, 8: PluginName plugin, @@ -185,7 +203,7 @@ struct InteractionTask { struct AddonInfo { 1: string func_name, 2: string description, - 3: ValueString value, + 3: JSONString value, } struct ConfigItem { @@ -193,8 +211,8 @@ struct ConfigItem { 2: string display_name, 3: string description, 4: string type, - 5: ValueString default_value, - 6: ValueString value, + 5: JSONString default_value, + 6: JSONString value, } struct ConfigSection { @@ -213,23 +231,30 @@ struct EventInfo { } struct UserData { - 1: string name, - 2: string email, - 3: i32 role, - 4: i32 permission, - 5: string templateName + 1: UserID uid, + 2: string name, + 3: string email, + 4: i16 role, + 5: i16 permission, + 6: string folder, + 7: ByteCount traffic + 8: i16 dllimit + 9: UserID user + 10: string templateName } struct AccountInfo { 1: PluginName plugin, 2: string loginname, - 3: bool valid, - 4: UTCDate validuntil, - 5: ByteCount trafficleft, - 6: ByteCount maxtraffic, - 7: bool premium, - 8: bool activated, - 9: map<string, string> options, + 3: UserID owner, + 4: bool valid, + 5: UTCDate validuntil, + 6: ByteCount trafficleft, + 7: ByteCount maxtraffic, + 8: bool premium, + 9: bool activated, + 10: bool shared, + 11: map<string, string> options, } struct AddonService { @@ -300,7 +325,7 @@ service Pyload { map<string, ConfigSection> getConfig(), map<PluginName, ConfigSection> getPluginConfig(), ConfigSection configureSection(1: string section), - void setConfigHandler(1: PluginName plugin, 2: InteractionID iid, 3: ValueString value), + void setConfigHandler(1: PluginName plugin, 2: InteractionID iid, 3: JSONString value), /////////////////////// // Download Preparing @@ -410,7 +435,7 @@ service Pyload { // mode = Output types binary ORed bool isInteractionWaiting(1: i16 mode), InteractionTask getInteractionTask(1: i16 mode), - void setInteractionResult(1: InteractionID iid, 2: ValueString result), + void setInteractionResult(1: InteractionID iid, 2: JSONString result), // generate a download link, everybody can download the file until timeout reached string generateDownloadLink(1: FileID fid, 2: i16 timeout), @@ -440,8 +465,20 @@ service Pyload { ///////////////////////// bool login(1: string username, 2: string password), - UserData getUserData(1: string username, 2: string password) throws (1: UserDoesNotExists ex), - map<string, UserData> getAllUserData(), + // returns own user data + UserData getUserData(), + + // all user, for admins only + map<UserID, UserData> getAllUserData(), + + UserData addUser(1: string username, 2:string password), + + // normal user can only update their own userdata and not all attributes + void updateUserData(1: UserData data), + void removeUser(1: UserID uid), + + // works contextual, admin can change every password + bool setPassword(1: string username, 2: string old_password, 3: string new_password), /////////////////////// // Addon Methods @@ -451,7 +488,7 @@ service Pyload { bool hasService(1: PluginName plugin, 2: string func), // empty string or json encoded list as args - string call(1: PluginName plugin, 2: string func, 3: string arguments) throws (1: ServiceDoesNotExists ex, 2: ServiceException e), + string call(1: PluginName plugin, 2: string func, 3: JSONString arguments) throws (1: ServiceDoesNotExists ex, 2: ServiceException e), map<PluginName, list<AddonInfo>> getAllInfo(), list<AddonInfo> getInfoByPlugin(1: PluginName plugin), diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote index 55f9a1823..c2c13d8ed 100755 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote @@ -42,7 +42,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' getConfig()' print ' getPluginConfig()' print ' ConfigSection configureSection(string section)' - print ' void setConfigHandler(PluginName plugin, InteractionID iid, ValueString value)' + print ' void setConfigHandler(PluginName plugin, InteractionID iid, JSONString value)' print ' checkURLs(LinkList urls)' print ' parseURLs(string html, string url)' print ' OnlineCheck checkOnlineStatus(LinkList urls)' @@ -89,7 +89,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' void orderFiles( fids, PackageID pid, i16 position)' print ' bool isInteractionWaiting(i16 mode)' print ' InteractionTask getInteractionTask(i16 mode)' - print ' void setInteractionResult(InteractionID iid, ValueString result)' + print ' void setInteractionResult(InteractionID iid, JSONString result)' print ' string generateDownloadLink(FileID fid, i16 timeout)' print ' getNotifications()' print ' getAddonHandler()' @@ -100,11 +100,15 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' void updateAccount(PluginName plugin, string account, string password, options)' print ' void removeAccount(PluginName plugin, string account)' print ' bool login(string username, string password)' - print ' UserData getUserData(string username, string password)' + print ' UserData getUserData()' print ' getAllUserData()' + print ' UserData addUser(string username, string password)' + print ' void updateUserData(UserData data)' + print ' void removeUser(UserID uid)' + print ' bool setPassword(string username, string old_password, string new_password)' print ' getServices()' print ' bool hasService(PluginName plugin, string func)' - print ' string call(PluginName plugin, string func, string arguments)' + print ' string call(PluginName plugin, string func, JSONString arguments)' print ' getAllInfo()' print ' getInfoByPlugin(PluginName plugin)' print '' @@ -621,10 +625,10 @@ elif cmd == 'login': pp.pprint(client.login(args[0],args[1],)) elif cmd == 'getUserData': - if len(args) != 2: - print 'getUserData requires 2 args' + if len(args) != 0: + print 'getUserData requires 0 args' sys.exit(1) - pp.pprint(client.getUserData(args[0],args[1],)) + pp.pprint(client.getUserData()) elif cmd == 'getAllUserData': if len(args) != 0: @@ -632,6 +636,30 @@ elif cmd == 'getAllUserData': sys.exit(1) pp.pprint(client.getAllUserData()) +elif cmd == 'addUser': + if len(args) != 2: + print 'addUser requires 2 args' + sys.exit(1) + pp.pprint(client.addUser(args[0],args[1],)) + +elif cmd == 'updateUserData': + if len(args) != 1: + print 'updateUserData requires 1 args' + sys.exit(1) + pp.pprint(client.updateUserData(eval(args[0]),)) + +elif cmd == 'removeUser': + if len(args) != 1: + print 'removeUser requires 1 args' + sys.exit(1) + pp.pprint(client.removeUser(eval(args[0]),)) + +elif cmd == 'setPassword': + if len(args) != 3: + print 'setPassword requires 3 args' + sys.exit(1) + pp.pprint(client.setPassword(args[0],args[1],args[2],)) + elif cmd == 'getServices': if len(args) != 0: print 'getServices requires 0 args' @@ -648,7 +676,7 @@ elif cmd == 'call': if len(args) != 3: print 'call requires 3 args' sys.exit(1) - pp.pprint(client.call(eval(args[0]),args[1],args[2],)) + pp.pprint(client.call(eval(args[0]),args[1],eval(args[2]),)) elif cmd == 'getAllInfo': if len(args) != 0: diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py index 51c8621ba..c45663d25 100644 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py @@ -9,7 +9,7 @@ from thrift.Thrift import TType, TMessageType, TException from ttypes import * from thrift.Thrift import TProcessor -from thrift.protocol.TBase import TBase, TExceptionBase +from thrift.protocol.TBase import TBase, TExceptionBase, TApplicationException class Iface(object): @@ -508,7 +508,13 @@ class Iface(object): """ pass - def getUserData(self, username, password): + def getUserData(self, ): + pass + + def getAllUserData(self, ): + pass + + def addUser(self, username, password): """ Parameters: - username @@ -516,7 +522,27 @@ class Iface(object): """ pass - def getAllUserData(self, ): + def updateUserData(self, data): + """ + Parameters: + - data + """ + pass + + def removeUser(self, uid): + """ + Parameters: + - uid + """ + pass + + def setPassword(self, username, old_password, new_password): + """ + Parameters: + - username + - old_password + - new_password + """ pass def getServices(self, ): @@ -2808,20 +2834,13 @@ class Client(Iface): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "login failed: unknown result"); - def getUserData(self, username, password): - """ - Parameters: - - username - - password - """ - self.send_getUserData(username, password) + def getUserData(self, ): + self.send_getUserData() return self.recv_getUserData() - def send_getUserData(self, username, password): + def send_getUserData(self, ): self._oprot.writeMessageBegin('getUserData', TMessageType.CALL, self._seqid) args = getUserData_args() - args.username = username - args.password = password args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() @@ -2838,8 +2857,6 @@ class Client(Iface): self._iprot.readMessageEnd() if result.success is not None: return result.success - if result.ex is not None: - raise result.ex raise TApplicationException(TApplicationException.MISSING_RESULT, "getUserData failed: unknown result"); def getAllUserData(self, ): @@ -2867,6 +2884,128 @@ class Client(Iface): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllUserData failed: unknown result"); + def addUser(self, username, password): + """ + Parameters: + - username + - password + """ + self.send_addUser(username, password) + return self.recv_addUser() + + def send_addUser(self, username, password): + self._oprot.writeMessageBegin('addUser', TMessageType.CALL, self._seqid) + args = addUser_args() + args.username = username + args.password = password + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_addUser(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = addUser_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "addUser failed: unknown result"); + + def updateUserData(self, data): + """ + Parameters: + - data + """ + self.send_updateUserData(data) + self.recv_updateUserData() + + def send_updateUserData(self, data): + self._oprot.writeMessageBegin('updateUserData', TMessageType.CALL, self._seqid) + args = updateUserData_args() + args.data = data + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_updateUserData(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = updateUserData_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + return + + def removeUser(self, uid): + """ + Parameters: + - uid + """ + self.send_removeUser(uid) + self.recv_removeUser() + + def send_removeUser(self, uid): + self._oprot.writeMessageBegin('removeUser', TMessageType.CALL, self._seqid) + args = removeUser_args() + args.uid = uid + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_removeUser(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = removeUser_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + return + + def setPassword(self, username, old_password, new_password): + """ + Parameters: + - username + - old_password + - new_password + """ + self.send_setPassword(username, old_password, new_password) + return self.recv_setPassword() + + def send_setPassword(self, username, old_password, new_password): + self._oprot.writeMessageBegin('setPassword', TMessageType.CALL, self._seqid) + args = setPassword_args() + args.username = username + args.old_password = old_password + args.new_password = new_password + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_setPassword(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = setPassword_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "setPassword failed: unknown result"); + def getServices(self, ): self.send_getServices() return self.recv_getServices() @@ -3101,6 +3240,10 @@ class Processor(Iface, TProcessor): self._processMap["login"] = Processor.process_login self._processMap["getUserData"] = Processor.process_getUserData self._processMap["getAllUserData"] = Processor.process_getAllUserData + self._processMap["addUser"] = Processor.process_addUser + self._processMap["updateUserData"] = Processor.process_updateUserData + self._processMap["removeUser"] = Processor.process_removeUser + self._processMap["setPassword"] = Processor.process_setPassword self._processMap["getServices"] = Processor.process_getServices self._processMap["hasService"] = Processor.process_hasService self._processMap["call"] = Processor.process_call @@ -4001,10 +4144,7 @@ class Processor(Iface, TProcessor): args.read(iprot) iprot.readMessageEnd() result = getUserData_result() - try: - result.success = self._handler.getUserData(args.username, args.password) - except UserDoesNotExists, ex: - result.ex = ex + result.success = self._handler.getUserData() oprot.writeMessageBegin("getUserData", TMessageType.REPLY, seqid) result.write(oprot) oprot.writeMessageEnd() @@ -4021,6 +4161,50 @@ class Processor(Iface, TProcessor): oprot.writeMessageEnd() oprot.trans.flush() + def process_addUser(self, seqid, iprot, oprot): + args = addUser_args() + args.read(iprot) + iprot.readMessageEnd() + result = addUser_result() + result.success = self._handler.addUser(args.username, args.password) + oprot.writeMessageBegin("addUser", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_updateUserData(self, seqid, iprot, oprot): + args = updateUserData_args() + args.read(iprot) + iprot.readMessageEnd() + result = updateUserData_result() + self._handler.updateUserData(args.data) + oprot.writeMessageBegin("updateUserData", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_removeUser(self, seqid, iprot, oprot): + args = removeUser_args() + args.read(iprot) + iprot.readMessageEnd() + result = removeUser_result() + self._handler.removeUser(args.uid) + oprot.writeMessageBegin("removeUser", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_setPassword(self, seqid, iprot, oprot): + args = setPassword_args() + args.read(iprot) + iprot.readMessageEnd() + result = setPassword_result() + result.success = self._handler.setPassword(args.username, args.old_password, args.new_password) + oprot.writeMessageBegin("setPassword", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_getServices(self, seqid, iprot, oprot): args = getServices_args() args.read(iprot) @@ -6695,6 +6879,60 @@ class login_result(TBase): class getUserData_args(TBase): + + __slots__ = [ + ] + + thrift_spec = ( + ) + + +class getUserData_result(TBase): + """ + Attributes: + - success + """ + + __slots__ = [ + 'success', + ] + + thrift_spec = ( + (0, TType.STRUCT, 'success', (UserData, UserData.thrift_spec), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + +class getAllUserData_args(TBase): + + __slots__ = [ + ] + + thrift_spec = ( + ) + + +class getAllUserData_result(TBase): + """ + Attributes: + - success + """ + + __slots__ = [ + 'success', + ] + + thrift_spec = ( + (0, TType.MAP, 'success', (TType.I32,None,TType.STRUCT,(UserData, UserData.thrift_spec)), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + +class addUser_args(TBase): """ Attributes: - username @@ -6717,38 +6955,108 @@ class getUserData_args(TBase): self.password = password -class getUserData_result(TBase): +class addUser_result(TBase): """ Attributes: - success - - ex """ __slots__ = [ 'success', - 'ex', ] thrift_spec = ( (0, TType.STRUCT, 'success', (UserData, UserData.thrift_spec), None, ), # 0 - (1, TType.STRUCT, 'ex', (UserDoesNotExists, UserDoesNotExists.thrift_spec), None, ), # 1 ) - def __init__(self, success=None, ex=None,): + def __init__(self, success=None,): self.success = success - self.ex = ex -class getAllUserData_args(TBase): +class updateUserData_args(TBase): + """ + Attributes: + - data + """ __slots__ = [ + 'data', ] thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'data', (UserData, UserData.thrift_spec), None, ), # 1 ) + def __init__(self, data=None,): + self.data = data + -class getAllUserData_result(TBase): +class updateUserData_result(TBase): + + __slots__ = [ + ] + + thrift_spec = ( + ) + + +class removeUser_args(TBase): + """ + Attributes: + - uid + """ + + __slots__ = [ + 'uid', + ] + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'uid', None, None, ), # 1 + ) + + def __init__(self, uid=None,): + self.uid = uid + + +class removeUser_result(TBase): + + __slots__ = [ + ] + + thrift_spec = ( + ) + + +class setPassword_args(TBase): + """ + Attributes: + - username + - old_password + - new_password + """ + + __slots__ = [ + 'username', + 'old_password', + 'new_password', + ] + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'username', None, None, ), # 1 + (2, TType.STRING, 'old_password', None, None, ), # 2 + (3, TType.STRING, 'new_password', None, None, ), # 3 + ) + + def __init__(self, username=None, old_password=None, new_password=None,): + self.username = username + self.old_password = old_password + self.new_password = new_password + + +class setPassword_result(TBase): """ Attributes: - success @@ -6759,7 +7067,7 @@ class getAllUserData_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING,None,TType.STRUCT,(UserData, UserData.thrift_spec)), None, ), # 0 + (0, TType.BOOL, 'success', None, None, ), # 0 ) def __init__(self, success=None,): diff --git a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py index fbbc599a8..c177a9dd2 100644 --- a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py +++ b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py @@ -191,6 +191,58 @@ class Output(TBase): "Query": 4, } +class Permission(TBase): + All = 0 + Add = 1 + Delete = 2 + Status = 4 + List = 16 + Modify = 32 + Download = 64 + Accounts = 128 + Interaction = 256 + Addons = 512 + + _VALUES_TO_NAMES = { + 0: "All", + 1: "Add", + 2: "Delete", + 4: "Status", + 16: "List", + 32: "Modify", + 64: "Download", + 128: "Accounts", + 256: "Interaction", + 512: "Addons", + } + + _NAMES_TO_VALUES = { + "All": 0, + "Add": 1, + "Delete": 2, + "Status": 4, + "List": 16, + "Modify": 32, + "Download": 64, + "Accounts": 128, + "Interaction": 256, + "Addons": 512, + } + +class Role(TBase): + Admin = 0 + User = 1 + + _VALUES_TO_NAMES = { + 0: "Admin", + 1: "User", + } + + _NAMES_TO_VALUES = { + "Admin": 0, + "User": 1, + } + class ProgressInfo(TBase): """ @@ -750,35 +802,55 @@ class EventInfo(TBase): class UserData(TBase): """ Attributes: + - uid - name - email - role - permission + - folder + - traffic + - limit + - user - templateName """ __slots__ = [ + 'uid', 'name', 'email', 'role', 'permission', + 'folder', + 'traffic', + 'limit', + 'user', 'templateName', ] thrift_spec = ( None, # 0 - (1, TType.STRING, 'name', None, None, ), # 1 - (2, TType.STRING, 'email', None, None, ), # 2 - (3, TType.I32, 'role', None, None, ), # 3 - (4, TType.I32, 'permission', None, None, ), # 4 - (5, TType.STRING, 'templateName', None, None, ), # 5 + (1, TType.I32, 'uid', None, None, ), # 1 + (2, TType.STRING, 'name', None, None, ), # 2 + (3, TType.STRING, 'email', None, None, ), # 3 + (4, TType.I16, 'role', None, None, ), # 4 + (5, TType.I16, 'permission', None, None, ), # 5 + (6, TType.STRING, 'folder', None, None, ), # 6 + (7, TType.I64, 'traffic', None, None, ), # 7 + (8, TType.I16, 'limit', None, None, ), # 8 + (9, TType.I32, 'user', None, None, ), # 9 + (10, TType.STRING, 'templateName', None, None, ), # 10 ) - def __init__(self, name=None, email=None, role=None, permission=None, templateName=None,): + def __init__(self, uid=None, name=None, email=None, role=None, permission=None, folder=None, traffic=None, limit=None, user=None, templateName=None,): + self.uid = uid self.name = name self.email = email self.role = role self.permission = permission + self.folder = folder + self.traffic = traffic + self.limit = limit + self.user = user self.templateName = templateName @@ -787,24 +859,28 @@ class AccountInfo(TBase): Attributes: - plugin - loginname + - owner - valid - validuntil - trafficleft - maxtraffic - premium - activated + - shared - options """ __slots__ = [ 'plugin', 'loginname', + 'owner', 'valid', 'validuntil', 'trafficleft', 'maxtraffic', 'premium', 'activated', + 'shared', 'options', ] @@ -812,24 +888,28 @@ class AccountInfo(TBase): None, # 0 (1, TType.STRING, 'plugin', None, None, ), # 1 (2, TType.STRING, 'loginname', None, None, ), # 2 - (3, TType.BOOL, 'valid', None, None, ), # 3 - (4, TType.I64, 'validuntil', None, None, ), # 4 - (5, TType.I64, 'trafficleft', None, None, ), # 5 - (6, TType.I64, 'maxtraffic', None, None, ), # 6 - (7, TType.BOOL, 'premium', None, None, ), # 7 - (8, TType.BOOL, 'activated', None, None, ), # 8 - (9, TType.MAP, 'options', (TType.STRING,None,TType.STRING,None), None, ), # 9 + (3, TType.I32, 'owner', None, None, ), # 3 + (4, TType.BOOL, 'valid', None, None, ), # 4 + (5, TType.I64, 'validuntil', None, None, ), # 5 + (6, TType.I64, 'trafficleft', None, None, ), # 6 + (7, TType.I64, 'maxtraffic', None, None, ), # 7 + (8, TType.BOOL, 'premium', None, None, ), # 8 + (9, TType.BOOL, 'activated', None, None, ), # 9 + (10, TType.BOOL, 'shared', None, None, ), # 10 + (11, TType.MAP, 'options', (TType.STRING,None,TType.STRING,None), None, ), # 11 ) - def __init__(self, plugin=None, loginname=None, valid=None, validuntil=None, trafficleft=None, maxtraffic=None, premium=None, activated=None, options=None,): + def __init__(self, plugin=None, loginname=None, owner=None, valid=None, validuntil=None, trafficleft=None, maxtraffic=None, premium=None, activated=None, shared=None, options=None,): self.plugin = plugin self.loginname = loginname + self.owner = owner self.valid = valid self.validuntil = validuntil self.trafficleft = trafficleft self.maxtraffic = maxtraffic self.premium = premium self.activated = activated + self.shared = shared self.options = options |