Added Character-level quelling possibilities to superuser. This makes the superuser quelling completely in line with normal quelling for other permission levels. It also removes the need for the special _superuser_character bypass used before (the migration no longer creates it an initial_setup won't either).

This commit is contained in:
Griatch 2013-05-14 14:53:08 +02:00
parent 77a0b47859
commit f00053710c
5 changed files with 30 additions and 33 deletions

View file

@ -28,7 +28,7 @@ class Migration(DataMigration):
# Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..."
lockstring = "attrread:perm(Admins);attredit:perm(Admins);attrcreate:perm(Admins)"
lockstring2 = "attrread:false();attredit:false();attrcreate:false()"
#lockstring2 = "attrread:false();attredit:false();attrcreate:false()"
if not db.dry_run:
for player in orm['players.PlayerDB'].objects.all():
char = player.db_obj
@ -47,14 +47,15 @@ class Migration(DataMigration):
db_value=val)
suser = char and char.id == 1
if suser:
# move the superuser unmask attribute for the superuser (note that this
# is not a security risk, it only works if player's superuser bit is set too)
val = pickle.dumps(("simple", suser))
orm['objects.ObjAttribute'].objects.create(db_key="_superuser_character",
db_obj=char,
db_lock_storage=lockstring2,
db_value=val)
#if suser:
# # REMOVED - this is not needed - Griatch
# # the superuser unmask attribute for the superuser (note that this
# # is not a security risk, it only works if player's superuser bit is set too)
# val = pickle.dumps(("simple", suser))
# orm['objects.ObjAttribute'].objects.create(db_key="_superuser_character",
# db_obj=char,
# db_lock_storage=lockstring2,
# db_value=val)
def backwards(self, orm):