use of edu.stanford.bmir.protege.web.shared.permissions.PermissionsChangedEvent in project webprotege by protegeproject.
the class PermissionManager method firePermissionsChanged.
/**
* Fires a {@link PermissionsChangedEvent} for the
* current project on the event bus.
*/
public void firePermissionsChanged() {
GWT.log("[PermissionManager] Firing permissions changed");
permittedActionCache.clear();
final UserId userId = loggedInUserProvider.getCurrentUserId();
final Optional<ProjectId> projectId = activeProjectManager.getActiveProjectId();
if (!projectId.isPresent()) {
return;
}
final ProjectId theProjectId = projectId.get();
dispatchServiceManager.execute(new GetProjectPermissionsAction(projectId.get(), userId), result -> {
UserIdProjectIdKey key = new UserIdProjectIdKey(userId, theProjectId);
permittedActionCache.putAll(key, result.getAllowedActions());
GWT.log("[PermissionManager] Firing permissions changed for project: " + projectId);
eventBus.fireEventFromSource(new PermissionsChangedEvent(theProjectId).asGWTEvent(), theProjectId);
});
}
Aggregations