changed security var "allow web access" to a simpler one that can easily be used from command line

This commit is contained in:
Adolfo Gómez 2014-01-23 06:01:29 +00:00
parent f5b4dd2ea6
commit 3ad2a84d55
2 changed files with 7 additions and 5 deletions

View File

@ -204,7 +204,7 @@ class GlobalConfig(object):
# Superuser password (do not need to be at database!!!)
SUPER_USER_PASS = Config.section(SECURITY_SECTION).valueCrypt('rootPass', 'udsmam0')
# Idle time before closing session on admin
SUPER_USER_ALLOW_WEBACCESS = Config.section(SECURITY_SECTION).value('Allow root web access', '1')
SUPER_USER_ALLOW_WEBACCESS = Config.section(SECURITY_SECTION).value('allowRootWebAccess', '1')
# Time an admi session can be idle before being "logged out"
ADMIN_IDLE_TIME = Config.section(GLOBAL_SECTION).value('adminIdleTime', '14400') # Defaults to 4 hous
# Time betwen checks of unused services by os managers

View File

@ -6,6 +6,8 @@ from django.db import models
from uds.core.util.Config import GLOBAL_SECTION, SECURITY_SECTION
configKeys = ['superUser', 'rootPass', 'adminIdleTime', 'allowRootWebAccess', 'userSessionLength' ]
class Migration(DataMigration):
def forwards(self, orm):
@ -15,15 +17,15 @@ class Migration(DataMigration):
# and orm['appname.ModelName'] for models in other applications.
if not db.dry_run:
# Remove existing secirity values if they exists before "migrating" global ones
orm.Config.objects.filter(section=SECURITY_SECTION,key__in=['superUser', 'rootPass', 'adminIdleTime', 'Allow root web access', 'userSessionLength' ]).delete()
orm.Config.objects.filter(section=GLOBAL_SECTION,key__in=['superUser', 'rootPass', 'adminIdleTime', 'Allow root web access', 'userSessionLength' ]).update(section=SECURITY_SECTION)
orm.Config.objects.filter(section=SECURITY_SECTION,key__in=configKeys).delete()
orm.Config.objects.filter(section=GLOBAL_SECTION,key__in=configKeys).update(section=SECURITY_SECTION)
def backwards(self, orm):
"Write your backwards methods here."
if not db.dry_run:
# Remove existing global existing values if they exists before "migrating back" security ones
orm.Config.objects.filter(section=GLOBAL_SECTION,key__in=['superUser', 'rootPass', 'adminIdleTime', 'Allow root web access', 'userSessionLength' ]).delete()
orm.Config.objects.filter(section=SECURITY_SECTION,key__in=['superUser', 'rootPass', 'adminIdleTime', 'Allow root web access', 'userSessionLength' ]).update(section=GLOBAL_SECTION)
orm.Config.objects.filter(section=GLOBAL_SECTION,key__in=configKeys).delete()
orm.Config.objects.filter(section=SECURITY_SECTION,key__in=configKeys).update(section=GLOBAL_SECTION)
models = {
u'uds.authenticator': {