Skip to content

Commit

Permalink
Merge pull request #38 from protegeproject/Configure_access_policies_…
Browse files Browse the repository at this point in the history
…for_WHOFIC_editors_#46

Configure access policies for whofic editors #46
  • Loading branch information
alexsilaghi authored Jul 5, 2024
2 parents e3104ea + 0d63687 commit 17bb663
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,10 @@ public interface Messages extends com.google.gwt.i18n.client.Messages {
@Key("sharing.edit")
String sharing_edit();

@DefaultMessage("ICD Edit")
@Key("sharing.icd.edit")
String sharing_icd_edit();


@DefaultMessage("Link sharing enabled")
@Key("sharing.linkSharingEnabled")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public void addAction(final UIAction action) {
button.addClickHandler(event -> action.execute());
action.setStateChangedHandler(value -> {
button.setEnabled(value.isEnabled());
button.setVisible(value.isVisible());
if (!action.hasIcon()) {
button.setText(value.getLabel());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ private static String getPermissionLabel(SharingPermission permission) {
return MESSAGES.sharing_manage();
case EDIT:
return MESSAGES.sharing_edit();
case ICD_EDIT:
return MESSAGES.sharing_icd_edit();
case COMMENT:
return MESSAGES.sharing_comment();
case VIEW:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,20 @@
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.web.bindery.event.shared.EventBus;
import edu.stanford.bmir.protege.web.client.Messages;
import edu.stanford.bmir.protege.web.client.app.PermissionScreener;
import edu.stanford.bmir.protege.web.client.app.Presenter;
import edu.stanford.bmir.protege.web.client.dispatch.DispatchErrorMessageDisplay;
import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallbackWithProgressDisplay;
import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager;
import edu.stanford.bmir.protege.web.client.dispatch.ProgressDisplay;
import edu.stanford.bmir.protege.web.client.app.*;
import edu.stanford.bmir.protege.web.client.dispatch.*;
import edu.stanford.bmir.protege.web.client.permissions.PermissionManager;
import edu.stanford.bmir.protege.web.client.progress.BusyView;
import edu.stanford.bmir.protege.web.client.settings.SettingsPresenter;
import edu.stanford.bmir.protege.web.client.uuid.UuidV4Provider;
import edu.stanford.bmir.protege.web.shared.perspective.ChangeRequestId;
import edu.stanford.bmir.protege.web.shared.project.ProjectId;
import edu.stanford.bmir.protege.web.shared.sharing.GetProjectSharingSettingsAction;
import edu.stanford.bmir.protege.web.shared.sharing.ProjectSharingSettings;
import edu.stanford.bmir.protege.web.shared.sharing.SetProjectSharingSettingsAction;
import edu.stanford.bmir.protege.web.shared.sharing.SetProjectSharingSettingsResult;
import edu.stanford.bmir.protege.web.shared.sharing.*;

import javax.annotation.Nonnull;
import javax.inject.Inject;
import java.util.Optional;
import java.util.logging.Logger;

import static com.google.common.base.Preconditions.checkNotNull;
import static edu.stanford.bmir.protege.web.shared.access.BuiltInAction.EDIT_SHARING_SETTINGS;
Expand Down Expand Up @@ -68,6 +62,8 @@ public class SharingSettingsPresenter implements Presenter {
@Nonnull
private UuidV4Provider uuidV4Provider;

private final static Logger logger = Logger.getLogger(SharingSettingsPresenter.class.getName());

@Inject
public SharingSettingsPresenter(@Nonnull ProjectId projectId,
@Nonnull SharingSettingsView view,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package edu.stanford.bmir.protege.web.shared.itemlist;

import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.*;
import com.google.common.base.Objects;
import edu.stanford.bmir.protege.web.shared.user.UserId;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package edu.stanford.bmir.protege.web.shared.sharing;

import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.*;
import com.google.common.base.Objects;
import edu.stanford.bmir.protege.web.shared.dispatch.Result;

Expand All @@ -25,7 +25,8 @@ private GetProjectSharingSettingsResult(ProjectSharingSettings projectSharingSet
this.projectSharingSettings = checkNotNull(projectSharingSettings);
}

public static GetProjectSharingSettingsResult create(ProjectSharingSettings projectSharingSettings) {
@JsonCreator
public static GetProjectSharingSettingsResult create(@JsonProperty("settings") ProjectSharingSettings projectSharingSettings) {
return new GetProjectSharingSettingsResult(projectSharingSettings);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.stanford.bmir.protege.web.shared.sharing;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Objects;
import edu.stanford.bmir.protege.web.shared.project.ProjectId;

Expand All @@ -22,7 +23,7 @@ public class ProjectSharingSettings implements Serializable {

private ProjectId projectId;

private List<SharingSetting> sharingSettings = new ArrayList<>();
private List<SharingSetting> sharingSettings;

@Nullable
private SharingPermission linkSharingPermission = null;
Expand All @@ -33,20 +34,25 @@ public class ProjectSharingSettings implements Serializable {
private ProjectSharingSettings() {
}

public ProjectSharingSettings(ProjectId projectId, Optional<SharingPermission> linkSharingPermission, List<SharingSetting> sharingSettings) {
public ProjectSharingSettings(@JsonProperty("projectId") ProjectId projectId,
@JsonProperty("linkSharingPermission") Optional<SharingPermission> linkSharingPermission,
@JsonProperty("sharingSettings") List<SharingSetting> sharingSettings) {
this.projectId = checkNotNull(projectId);
this.sharingSettings.addAll(checkNotNull(sharingSettings));
this.sharingSettings = new ArrayList<>(checkNotNull(sharingSettings));
this.linkSharingPermission = checkNotNull(linkSharingPermission).orElse(null);
}

@JsonProperty("projectId")
public ProjectId getProjectId() {
return projectId;
}

@JsonProperty("sharingSettings")
public List<SharingSetting> getSharingSettings() {
return new ArrayList<>(sharingSettings);
}

@JsonProperty("linkSharingPermission")
public Optional<SharingPermission> getLinkSharingPermission() {
return Optional.ofNullable(linkSharingPermission);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public enum SharingPermission implements Serializable {
*/
EDIT,

ICD_EDIT,

/**
* A user can manage a project
*/
Expand Down

0 comments on commit 17bb663

Please sign in to comment.