diff options
author | Leif Johansson <leifj@sunet.se> | 2011-10-12 00:35:48 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-10-12 00:35:48 +0200 |
commit | 3f994b6b22d1dad45bcc519cd068b8c1dd58b41f (patch) | |
tree | c5e3c34993d4a85aa7e81965d7035cd66e30cc61 | |
parent | 982f28708e23b148e9855db42a6fc7e419223474 (diff) |
room owner not requestor permissions
-rw-r--r-- | src/meetingtools/apps/room/models.py | 4 | ||||
-rw-r--r-- | src/meetingtools/apps/room/views.py | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/meetingtools/apps/room/models.py b/src/meetingtools/apps/room/models.py index 74ed1b1..b636816 100644 --- a/src/meetingtools/apps/room/models.py +++ b/src/meetingtools/apps/room/models.py @@ -18,7 +18,7 @@ from tagging.models import Tag class Room(models.Model): creator = ForeignKey(User,editable=False) - name = CharField(max_length=128,unique=True) + name = CharField(max_length=128) urlpath = CharField(verbose_name="Custom URL",max_length=128,unique=True) acc = ForeignKey(ACCluster,verbose_name="Adobe Connect Cluster",editable=False) self_cleaning = BooleanField(verbose_name="Clean-up when empty?") @@ -34,7 +34,7 @@ class Room(models.Model): lastvisited = models.DateTimeField(blank=True,null=True) class Meta: - unique_together = ('acc','sco_id') + unique_together = (('acc','sco_id'),('name','folder_sco_id')) def __unicode__(self): return "%s (sco_id=%s,source_sco_id=%s,folder_sco_id=%s,urlpath=%s)" % (self.name,self.sco_id,self.source_sco_id,self.folder_sco_id,self.urlpath) diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index 955e093..169cb1a 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -236,8 +236,15 @@ def update(request,id): def _import_room(request,acc,r): modified = False room = None + + if not r.has_key('name'): + return + try: room = Room.objects.get(sco_id=r['sco_id'],acc=acc) + if not room.name: + room.delete() + return except ObjectDoesNotExist: if r['folder_sco_id']: room = Room.objects.create(sco_id=r['sco_id'],acc=acc,creator=request.user,folder_sco_id=r['folder_sco_id']) |