use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.
the class GetEmailAddressActionTestCase method getUserIdReturnsSuppliedUserId.
@Test
public void getUserIdReturnsSuppliedUserId() {
UserId userId = UserId.getUserId("UserA");
GetEmailAddressAction action = new GetEmailAddressAction(userId);
assertEquals(userId, action.getUserId());
}
use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.
the class GetEmailAddressActionTestCase method hashCodeReturnsSameValueForSameUserId.
@Test
public void hashCodeReturnsSameValueForSameUserId() {
UserId userId = UserId.getUserId("UserC");
GetEmailAddressAction actionA = new GetEmailAddressAction(userId);
GetEmailAddressAction actionB = new GetEmailAddressAction(userId);
assertEquals(actionA.hashCode(), actionB.hashCode());
}
use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.
the class PerspectiveLinkManagerImpl method removeLinkedPerspective.
public void removeLinkedPerspective(final PerspectiveId perspectiveId, final Callback callback) {
final UserId userId = loggedInUserProvider.getCurrentUserId();
dispatchServiceManager.execute(new GetPerspectivesAction(projectId, userId), new DispatchServiceCallback<GetPerspectivesResult>() {
@Override
public void handleSuccess(GetPerspectivesResult result) {
final List<PerspectiveId> ids = new ArrayList<>(result.getPerspectives());
ids.remove(perspectiveId);
dispatchServiceManager.execute(new SetPerspectivesAction(projectId, userId, ImmutableList.copyOf(ids)), new DispatchServiceCallback<SetPerspectivesResult>() {
@Override
public void handleSuccess(SetPerspectivesResult setPerspectivesResult) {
callback.handlePerspectives(ids);
}
});
}
});
}
use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.
the class LoggedInUserProjectPermissionCheckerImpl method hasPermission.
@Override
public void hasPermission(@Nonnull ActionId actionId, @Nonnull DispatchServiceCallback<Boolean> callback) {
Optional<ProjectId> projectId = activeProjectManager.getActiveProjectId();
if (!projectId.isPresent()) {
callback.onSuccess(false);
return;
}
UserId userId = loggedInUserProvider.getCurrentUserId();
GWT.log("[LoggedInUserProjectPermissionCheckerImpl] Checking permissions for: " + userId + " on " + projectId.get());
permissionManager.hasPermissionForProject(userId, actionId, projectId.get(), callback);
}
use of edu.stanford.bmir.protege.web.shared.user.UserId in project webprotege by protegeproject.
the class ChangeEmailAddressPresenter method changeEmail.
public void changeEmail() {
final UserId userId = loggedInUserProvider.getCurrentUserId();
if (userId.isGuest()) {
MessageBox.showAlert("You must be logged in to change your email address");
return;
}
ProgressMonitor.get().showProgressMonitor("Retrieving email address", "Please wait.");
dispatchServiceManager.execute(new GetEmailAddressAction(userId), new DispatchServiceCallback<GetEmailAddressResult>() {
@Override
public void handleSuccess(GetEmailAddressResult result) {
showDialog(result.getEmailAddress());
ProgressMonitor.get().hideProgressMonitor();
}
@Override
public void handleFinally() {
ProgressMonitor.get().hideProgressMonitor();
}
});
}
Aggregations