Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5cfe642
commit f668af4
Showing
5 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
src/main/java/com/genericconf/bbbgateway/web/pages/ManageMeeting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
* Copyright 2010 Generic Conferencing, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.genericconf.bbbgateway.web.pages; | ||
|
||
import java.util.UUID; | ||
|
||
import org.apache.commons.codec.digest.DigestUtils; | ||
import org.apache.wicket.PageParameters; | ||
import org.apache.wicket.RestartResponseAtInterceptPageException; | ||
import org.apache.wicket.model.AbstractReadOnlyModel; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.LoadableDetachableModel; | ||
import org.apache.wicket.spring.injection.annot.SpringBean; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.genericconf.bbbgateway.domain.Meeting; | ||
import com.genericconf.bbbgateway.services.IMeetingService; | ||
|
||
public class ManageMeeting extends BasePage { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(ManageMeeting.class); | ||
private static final String SALT = UUID.randomUUID().toString(); | ||
|
||
@SpringBean | ||
private IMeetingService meetingService; | ||
|
||
public ManageMeeting(PageParameters params) { | ||
final String meetingID = params.getString("0"); | ||
String check = params.getString("1"); | ||
boolean okay = createCheck(meetingID).equals(check); | ||
logger.info("meeting ID: " + meetingID + "; check: " + check + "; okay: " + okay); | ||
if (!okay) { | ||
getSession().error("You are not authorized to manage that meeting"); | ||
throw new RestartResponseAtInterceptPageException(HomePage.class); | ||
} | ||
IModel<Meeting> model = new LoadableDetachableModel<Meeting>() { | ||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
protected Meeting load() { | ||
return meetingService.findByMeetingID(meetingID); | ||
} | ||
}; | ||
setDefaultModel(model); | ||
} | ||
|
||
@Override | ||
protected IModel<String> createContentHeaderLabelModel() { | ||
return new AbstractReadOnlyModel<String>() { | ||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public String getObject() { | ||
return "Manage meeting: " + ManageMeeting.this.getModel().getObject().getName(); | ||
} | ||
}; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
protected IModel<Meeting> getModel() { | ||
return (IModel<Meeting>) getDefaultModel(); | ||
} | ||
|
||
public static PageParameters createParams(Meeting meeting) { | ||
PageParameters pp = new PageParameters(); | ||
pp.put("0", meeting.getMeetingID()); | ||
pp.put("1", createCheck(meeting.getMeetingID())); | ||
return pp; | ||
} | ||
|
||
private static String createCheck(String meetingID) { | ||
return DigestUtils.md5Hex(SALT + meetingID); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters