@@ -66,7 +66,11 @@ public TemplateInstance all() {
6666 @ GET
6767 @ Path ("{sessionId}" )
6868 public TemplateInstance view (@ PathParam ("sessionId" ) String sessionId , @ Context SecurityIdentity securityIdentity ) {
69- var session = talksService .getSession (securityIdentity .getPrincipal ().getName (), sessionId );
69+ var email = UserHelper .getEmail (securityIdentity );
70+ var session = talksService .getSession (email , sessionId );
71+
72+ if (!session .containsEmail (email ))
73+ throw new NotAllowedException ("Not allowed to view this session" );
7074
7175 return talk .data ("session" , session );
7276 }
@@ -84,7 +88,7 @@ public TemplateInstance newSession(@Context SecurityIdentity securityIdentity) {
8488 }};
8589 form .speakers = new ArrayList <>();
8690 form .speakers .add (new SpeakerForm () {{
87- this .email = securityIdentity . getPrincipal (). getName ( );
91+ this .email = UserHelper . getEmail ( securityIdentity );
8892 }});
8993
9094 return sessionForm
@@ -114,7 +118,7 @@ public Object newSessionPost(SessionForm form, @Context SecurityIdentity securit
114118 // Prepare form for sending
115119 var session = form .asSession ();
116120 session .conferenceId = conferenceService .current ().id ;
117- session .postedBy = securityIdentity . getPrincipal (). getName ( );
121+ session .postedBy = UserHelper . getEmail ( securityIdentity );
118122 session .status = initialStatus ;
119123
120124 // Send form data
@@ -129,7 +133,12 @@ public Object newSessionPost(SessionForm form, @Context SecurityIdentity securit
129133 @ GET
130134 @ Path ("{sessionId}/edit" )
131135 public TemplateInstance editSession (@ PathParam ("sessionId" ) String sessionId , @ Context SecurityIdentity securityIdentity ) {
132- var session = talksService .getSession (securityIdentity .getPrincipal ().getName (), sessionId );
136+ var email = UserHelper .getEmail (securityIdentity );
137+
138+ var session = talksService .getSession (email , sessionId );
139+
140+ if (!session .containsEmail (email ))
141+ throw new NotAllowedException ("Not allowed to view this session" );
133142
134143 if (!conferenceService .current ().id .equals (session .conferenceId ))
135144 throw new NotFoundException ();
@@ -155,7 +164,7 @@ public Object editSessionPost(@PathParam("sessionId") String sessionId, SessionF
155164
156165 // Prepare form for sending
157166 var session = form .asSession ();
158- session .postedBy = securityIdentity . getPrincipal (). getName ( );
167+ session .postedBy = UserHelper . getEmail ( securityIdentity );
159168 session .sessionId = sessionId ;
160169
161170 // Send form data
@@ -167,21 +176,6 @@ public Object editSessionPost(@PathParam("sessionId") String sessionId, SessionF
167176 .build ();
168177 }
169178
170- @ POST
171- @ Path ("{sessionId}/submit" )
172- public Response submitTalk (@ PathParam ("sessionId" ) String sessionId , @ Context SecurityIdentity securityIdentity ) {
173- var session = talksService .getSession (securityIdentity .getPrincipal ().getName (), sessionId );
174-
175- if (session .conferenceId .equals (conferenceService .current ().id )) {
176- session .status = "SUBMITTED" ;
177- talksService .updateSession (session .postedBy , sessionId , session );
178- }
179-
180- return Response
181- .seeOther (UriBuilder .fromUri ("/talk/{sessionID}" ).build (sessionId ))
182- .build ();
183- }
184-
185179 @ GET
186180 @ Path ("new/_speaker" )
187181 public TemplateInstance addSpeaker () {
0 commit comments