@@ -37,7 +37,7 @@ def generate_arena_token_v1(
37
37
user ,
38
38
username ,
39
39
realm = "realm" ,
40
- namespaced_scene = None ,
40
+ ns_scene = None ,
41
41
device = None ,
42
42
camid = None ,
43
43
userid = None ,
@@ -54,7 +54,7 @@ def generate_arena_token_v1(
54
54
user (object): User object
55
55
username (str): _description_
56
56
realm (str, optional): _description_. Defaults to "realm".
57
- scene (str, optional): _description_. Defaults to None.
57
+ ns_scene (str, optional): _description_. Defaults to None.
58
58
device (str, optional): _description_. Defaults to None.
59
59
camid (str, optional): _description_. Defaults to None.
60
60
userid (str, optional): _description_. Defaults to None.
@@ -85,22 +85,22 @@ def generate_arena_token_v1(
85
85
p_users = SCENE_USERS_DEF
86
86
87
87
# create permissions shorthand
88
- if namespaced_scene and Scene .objects .filter (name = namespaced_scene ).exists ():
89
- scene_perm = Scene .objects .get (name = namespaced_scene )
88
+ if ns_scene and Scene .objects .filter (name = ns_scene ).exists ():
89
+ scene_perm = Scene .objects .get (name = ns_scene )
90
90
p_public_read = scene_perm .public_read
91
91
p_public_write = scene_perm .public_write
92
92
p_anonymous_users = scene_perm .anonymous_users
93
93
p_video = scene_perm .video_conference
94
94
p_users = scene_perm .users
95
95
96
96
# add jitsi server params if a/v scene
97
- if namespaced_scene and camid and p_users and p_video :
97
+ if ns_scene and camid and p_users and p_video :
98
98
host = os .getenv ("HOSTNAME" )
99
99
headers = {"kid" : host }
100
100
payload ["aud" ] = "arena"
101
101
payload ["iss" ] = "arena-account"
102
102
# we use the namespace + scene name as the jitsi room name, handle RFC 3986 reserved chars as = '_'
103
- roomname = re .sub (r"[!#$&'()*+,\/:;=?@[\]]" , '_' , namespaced_scene .lower ())
103
+ roomname = re .sub (r"[!#$&'()*+,\/:;=?@[\]]" , '_' , ns_scene .lower ())
104
104
payload ["room" ] = roomname
105
105
106
106
# everyone should be able to read all public scenes
@@ -125,8 +125,8 @@ def generate_arena_token_v1(
125
125
subs .append (f"{ realm } /env/#" )
126
126
pubs .append (f"{ realm } /env/#" )
127
127
# vio experiments, staff only
128
- if namespaced_scene :
129
- pubs .append (f"{ realm } /vio/{ namespaced_scene } /#" )
128
+ if ns_scene :
129
+ pubs .append (f"{ realm } /vio/{ ns_scene } /#" )
130
130
else :
131
131
# scene owners have rights to their scene objects only
132
132
subs .append (f"{ realm } /s/{ username } /#" )
@@ -137,7 +137,7 @@ def generate_arena_token_v1(
137
137
# add scenes that have been granted by other owners
138
138
u_scenes = Scene .objects .filter (editors = user )
139
139
for u_scene in u_scenes :
140
- if not namespaced_scene or (namespaced_scene and u_scene .name == namespaced_scene ):
140
+ if not ns_scene or (ns_scene and u_scene .name == ns_scene ):
141
141
subs .append (f"{ realm } /s/{ u_scene .name } /#" )
142
142
pubs .append (f"{ realm } /s/{ u_scene .name } /#" )
143
143
subs .append (f"{ realm } /env/{ u_scene .name } /#" )
@@ -153,28 +153,28 @@ def generate_arena_token_v1(
153
153
pubs .append (f"{ realm } /d/{ username } /#" )
154
154
155
155
# anon/non-owners have rights to view scene objects only
156
- if namespaced_scene and not user .is_staff :
156
+ if ns_scene and not user .is_staff :
157
157
# did the user set specific public read or public write?
158
158
if not user .is_authenticated and not p_anonymous_users :
159
159
return None # anonymous not permitted
160
160
if p_public_read :
161
- subs .append (f"{ realm } /s/{ namespaced_scene } /#" )
161
+ subs .append (f"{ realm } /s/{ ns_scene } /#" )
162
162
# Interactivity to extent of viewing objects is similar to publishing env
163
- pubs .append (f"{ realm } /env/{ namespaced_scene } /#" )
163
+ pubs .append (f"{ realm } /env/{ ns_scene } /#" )
164
164
if p_public_write :
165
- pubs .append (f"{ realm } /s/{ namespaced_scene } /#" )
165
+ pubs .append (f"{ realm } /s/{ ns_scene } /#" )
166
166
# user presence objects
167
167
if camid and p_users : # probable web browser write
168
- pubs .append (f"{ realm } /s/{ namespaced_scene } /{ camid } " )
169
- pubs .append (f"{ realm } /s/{ namespaced_scene } /{ camid } /#" )
168
+ pubs .append (f"{ realm } /s/{ ns_scene } /{ camid } " )
169
+ pubs .append (f"{ realm } /s/{ ns_scene } /{ camid } /#" )
170
170
if handleftid and p_users :
171
- pubs .append (f"{ realm } /s/{ namespaced_scene } /{ handleftid } " )
171
+ pubs .append (f"{ realm } /s/{ ns_scene } /{ handleftid } " )
172
172
if handrightid and p_users :
173
- pubs .append (f"{ realm } /s/{ namespaced_scene } /{ handrightid } " )
173
+ pubs .append (f"{ realm } /s/{ ns_scene } /{ handrightid } " )
174
174
175
175
# chat messages
176
- if namespaced_scene and userid and p_users :
177
- namespace = namespaced_scene .split ("/" )[0 ]
176
+ if ns_scene and userid and p_users :
177
+ namespace = ns_scene .split ("/" )[0 ]
178
178
# receive private messages: Read
179
179
subs .append (f"{ realm } /c/{ namespace } /p/{ userid } /#" )
180
180
# receive open messages to everyone and/or scene: Read
@@ -185,7 +185,7 @@ def generate_arena_token_v1(
185
185
pubs .append (f"{ realm } /c/{ namespace } /p/+/{ userid } " )
186
186
187
187
# apriltags
188
- if namespaced_scene :
188
+ if ns_scene :
189
189
subs .append (f"{ realm } /g/a/#" )
190
190
pubs .append (f"{ realm } /g/a/#" )
191
191
0 commit comments