use of org.rstudio.studio.client.workbench.model.Agreement in project rstudio by rstudio.
the class Application method verifyAgreement.
private void verifyAgreement(SessionInfo sessionInfo, final Operation verifiedOperation) {
// get the agreement (if any)
final Agreement agreement = sessionInfo.pendingAgreement();
// execute the verifiedOperation immediately)
if (agreement != null) {
// append updated to the title if necessary
String title = agreement.getTitle();
if (agreement.getUpdated())
title += " (Updated)";
view_.showApplicationAgreement(// title and contents
title, agreement.getContents(), // bail to sign in page if the user doesn't confirm
new Operation() {
public void execute() {
if (Desktop.isDesktop()) {
Desktop.getFrame().setPendingQuit(DesktopFrame.PENDING_QUIT_AND_EXIT);
server_.quitSession(false, null, null, GWT.getHostPageBaseURL(), new SimpleRequestCallback<Boolean>());
} else
navigateToSignIn();
}
}, // user confirmed
new Operation() {
public void execute() {
// call verified operation
verifiedOperation.execute();
// record agreement on server
server_.acceptAgreement(agreement, new VoidServerRequestCallback());
}
});
} else {
// no agreement pending
verifiedOperation.execute();
}
}
Aggregations