From 03477f1568d145c3bc6bd4e80fac38cee825d15f Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Tue, 3 May 2011 15:08:39 +0200 Subject: using django_co_acls only makes this complicated --- src/meetingtools/apps/room/models.py | 4 ---- src/meetingtools/apps/room/views.py | 28 +++++++++++++--------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/meetingtools/apps/room/models.py b/src/meetingtools/apps/room/models.py index 1c7f2cd..5c3e9a5 100644 --- a/src/meetingtools/apps/room/models.py +++ b/src/meetingtools/apps/room/models.py @@ -17,10 +17,6 @@ class Room(models.Model): name = CharField(max_length=128,unique=True) urlpath = CharField(max_length=128,unique=True) acc = ForeignKey(ACCluster,verbose_name="Adobe Connect Cluster",editable=False) - acl = ForeignKey(AccessControlEntry,blank=True,null=True) - #participants = CharField(max_length=255,blank=True,verbose_name="Participants") # populate from entitlement held by creator session - #presenters = CharField(max_length=255,blank=True,verbose_name="Presenters") # populate from entitlement held by creator session - #hosts = CharField(max_length=255,blank=True,verbose_name="Hosts") # populate from entitlement held by creator session self_cleaning = BooleanField(verbose_name="Clean-up when empty?") sco_id = IntegerField(verbose_name="Adobe Connect Room") source_sco_id = IntegerField(verbose_name="Template",blank=True,null=True) diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index 0489d63..0084018 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -21,7 +21,6 @@ from meetingtools.settings import GRACE from django.utils.datetime_safe import datetime from django.http import HttpResponseRedirect from django.core.exceptions import ObjectDoesNotExist -from django_co_acls.models import allow, deny, acl def _acc_for_user(user): (local,domain) = user.username.split('@') @@ -144,27 +143,26 @@ def _update_room(request, room, form=None): room.save() logging.debug(pformat(room)) + #r = api.request('permissions-reset',{'acl-id': room.sco_id},True) + user_principal = api.find_user(request.user.username) + api.request('permissions-update',{'acl-id': room.sco_id,'principal-id': user_principal.get('principal-id'),'permission-id':'host'},True) # owner is always host + for (key,perm) in [('participants','view'),('presenters','mini-host'),('hosts','host')]: if form.cleaned_data.has_key(key): group = form.cleaned_data[key] if not group and key == 'participants': - group = "anyone" permission = "view-hidden" + principal_id = "public-access" + else: + permission = perm + principal_id = user_principal.get('principal-id') if group: - allow(room, group, permission) - else: - deny(room,group,permission) - - r = api.request('permissions-reset',{'acl-id': room.sco_id},True) - user_principal = api.find_user(request.user.username) - r = api.request('permissions-update',{'acl-id': room.sco_id,'principal-id': user_principal.get('principal-id'),'permission-id':'host'}) # owner is always host - for ace in acl(room): - principal_id = "public-access" - if ace.group: - principal_id = ace.group.name - r = api.request('permissions-update',{'acl-id': room.sco_id, 'principal-id': principal_id, 'permission-id': ace.permission},True) - + group_principal = api.find_group(group.name) + principal_id = group_principal.get('principal-id') + + api.request('permissions-update',{'acl-id': room.sco_id, 'principal-id': principal_id, 'permission-id': permission},True) + return room @login_required -- cgit v1.1