Example #1
0
 def __init__(self):
     self.logger = logging.getLogger('modules.users')
     Manageusers.createTable(ifNotExists=True)
     htpc.MODULES.append({
         'name': 'Manage users',
         'description': '<div class="alert alert-block alert-danger"><i class="fa fa-exclamation-triangle fa-fw"></i> Make sure you enable authentication and provide a master username and password in General settings, otherwise authentication will not be used.</div>',
         'isThirdParty': False,
         'id': 'users',
         'action': htpc.WEBDIR + 'users/setusers',
         'fields': [
             {'type': 'select',
              'label': 'User',
              'name': 'users_user_id',
              'options': [{'name': 'New', 'value': 0}]
             },
             {'type': 'text',
              'label': 'Username',
              'name': 'users_user_username'},
             {'type': 'password',
              'label': 'Password',
              'name': 'users_user_password'},
             {'type': 'select',
              'label': 'Role',
              'name': 'users_user_role',
              'desc': 'Admin users can change settings whilst normal users can only view pages.',
              'options': [
                     {'name': 'restricted user', 'value': 'restricted_user'},
                     {'name': 'user', 'value': 'user'},
                     {'name': 'admin', 'value': 'admin'}
                 ]
             }
         ]
     })
Example #2
0
 def __init__(self):
     self.logger = logging.getLogger('modules.users')
     Manageusers.createTable(ifNotExists=True)
     htpc.MODULES.append({
         'name': 'Manage users',
         'description': 'Add more users to HTPC-Manager. Make sure you enable authentication and have provided a master username and password in General settings, otherwise authentication will not be used.',
         'isThirdParty': False,
         'id': 'users',
         'action': htpc.WEBDIR + 'users/setusers',
         'fields': [
             {'type':'select',
              'label':'User',
              'name':'users_user_id',
              'options':[
                 {'name':'New', 'value':0}
             ]},
             {'type':'text',
              'label':'Username',
              'name':'users_user_username'},
             {'type':'password',
              'label':'Password',
              'name':'users_user_password'},
             {'type':'select',
              'label':'Role',
              'name': 'users_user_role',
              'desc': 'Admin users can change settings while normal users can only view pages.',
              'options': [
                 {'name': 'user', 'value':'user'},
                 {'name':'admin', 'value': 'admin'}
                 ]}
     ]})
Example #3
0
    def updatebl(self):
        # fix me
        from modules.newznab import NewznabIndexers
        from modules.kodi import KodiServers
        from htpc.manageusers import Manageusers
        NewznabIndexers.createTable(ifNotExists=True)
        KodiServers.createTable(ifNotExists=True)
        Manageusers.createTable(ifNotExists=True)

        bl = []

        fl = Setting.select().orderBy(Setting.q.key)
        for i in fl:
            if i.key.endswith("_apikey") or i.key.endswith("_username") or i.key.endswith("_password") or i.key.endswith("_passkey"):
                if len(i.val) > 1:
                    bl.append(i.val)

        indexers = NewznabIndexers.select().orderBy(NewznabIndexers.q.apikey)
        for indexer in indexers:
            if len(indexer.apikey) > 1:
                bl.append(indexer.apikey)

        kodi = KodiServers.select().orderBy(KodiServers.q.password)
        for k in kodi:
            if len(k.password) > 1:
                bl.append(k.password)

        users = Manageusers.select().orderBy(Manageusers.q.username)
        for user in users:
            if len(user.password) > 1:
                bl.append(user.password)

        htpc.BLACKLISTWORDS = bl
        return bl