Skip to content

Commit

Permalink
Closes #2283 - Extend models and data for READTASKS AND EDITTASKS
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesrdi authored and ryzheboka committed Jun 1, 2023
1 parent f2a62c6 commit 7e218fb
Show file tree
Hide file tree
Showing 11 changed files with 158 additions and 96 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ CREATE TABLE WORKBASKET_ACCESS_LIST
PERM_CUSTOM_10 SMALLINT NOT NULL,
PERM_CUSTOM_11 SMALLINT NOT NULL,
PERM_CUSTOM_12 SMALLINT NOT NULL,
PERM_READTASKS SMALLINT NOT NULL,
PERM_EDITTASKS SMALLINT NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT UC_ACCESSID_WBID UNIQUE (ACCESS_ID, WORKBASKET_ID),
CONSTRAINT ACCESS_LIST_WB FOREIGN KEY (WORKBASKET_ID) REFERENCES WORKBASKET ON DELETE CASCADE
Expand Down Expand Up @@ -446,4 +448,4 @@ COMMIT WORK ;
CREATE INDEX IDX_OBJECT_REFERE_ACCESS_LIST ON OBJECT_REFERENCE
(VALUE ASC, TYPE ASC, SYSTEM_INSTANCE ASC, SYSTEM ASC, COMPANY ASC, ID ASC)
ALLOW REVERSE SCANS COLLECT SAMPLED DETAILED STATISTICS;
COMMIT WORK ;
COMMIT WORK ;
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ CREATE TABLE WORKBASKET_ACCESS_LIST
PERM_CUSTOM_10 SMALLINT NOT NULL,
PERM_CUSTOM_11 SMALLINT NOT NULL,
PERM_CUSTOM_12 SMALLINT NOT NULL,
PERM_READTASKS SMALLINT NOT NULL,
PERM_EDITTASKS SMALLINT NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT UC_ACCESSID_WBID UNIQUE (ACCESS_ID, WORKBASKET_ID),
CONSTRAINT ACCESS_LIST_WB FOREIGN KEY (WORKBASKET_ID) REFERENCES WORKBASKET ON DELETE CASCADE
Expand Down Expand Up @@ -445,4 +447,4 @@ CREATE INDEX IDX_OBJECT_REFERE_FK_TASK_ID ON OBJECT_REFERENCE
COMMIT WORK ;
CREATE INDEX IDX_OBJECT_REFERE_ACCESS_LIST ON OBJECT_REFERENCE
(VALUE ASC, TYPE ASC, SYSTEM_INSTANCE ASC, SYSTEM ASC, COMPANY ASC, ID ASC);
COMMIT WORK ;
COMMIT WORK ;
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ CREATE TABLE WORKBASKET_ACCESS_LIST
PERM_CUSTOM_10 NUMBER(1) NOT NULL CHECK (PERM_CUSTOM_10 IN (0,1)),
PERM_CUSTOM_11 NUMBER(1) NOT NULL CHECK (PERM_CUSTOM_11 IN (0,1)),
PERM_CUSTOM_12 NUMBER(1) NOT NULL CHECK (PERM_CUSTOM_12 IN (0,1)),
PERM_READTASKS NUMBER(1) NOT NULL CHECK (PERM_READTASKS IN (0,1)),
PERM_EDITTASKS NUMBER(1) NOT NULL CHECK (PERM_EDITTASKS IN (0,1)),
CONSTRAINT WORKBASKET_ACCESS_LIST_PKEY PRIMARY KEY (ID),
CONSTRAINT UC_ACCESSID_WBID UNIQUE (ACCESS_ID, WORKBASKET_ID),
CONSTRAINT ACCESS_LIST_WB FOREIGN KEY (WORKBASKET_ID) REFERENCES WORKBASKET(ID) ON DELETE CASCADE
Expand Down Expand Up @@ -444,4 +446,4 @@ CREATE INDEX IDX_OBJECT_REFERE_FK_TASK_ID ON OBJECT_REFERENCE
COMMIT WORK ;
CREATE INDEX IDX_OBJECT_REFERE_ACCESS_LIST ON OBJECT_REFERENCE
(VALUE ASC, TYPE ASC, SYSTEM_INSTANCE ASC, SYSTEM ASC, COMPANY ASC, ID ASC);
COMMIT WORK ;
COMMIT WORK ;
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ CREATE TABLE WORKBASKET_ACCESS_LIST
PERM_CUSTOM_10 BOOLEAN NOT NULL,
PERM_CUSTOM_11 BOOLEAN NOT NULL,
PERM_CUSTOM_12 BOOLEAN NOT NULL,
PERM_READTASKS BOOLEAN NOT NULL,
PERM_EDITTASKS BOOLEAN NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT UC_ACCESSID_WBID UNIQUE (ACCESS_ID, WORKBASKET_ID),
CONSTRAINT ACCESS_LIST_WB FOREIGN KEY (WORKBASKET_ID) REFERENCES WORKBASKET ON DELETE CASCADE
Expand Down Expand Up @@ -441,4 +443,4 @@ CREATE INDEX IDX_OBJECT_REFERE_FK_TASK_ID ON OBJECT_REFERENCE
COMMIT WORK ;
CREATE INDEX IDX_OBJECT_REFERE_ACCESS_LIST ON OBJECT_REFERENCE
(VALUE ASC, TYPE ASC, SYSTEM_INSTANCE ASC, SYSTEM ASC, COMPANY ASC, ID ASC);
COMMIT WORK ;
COMMIT WORK ;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/** This enum contains all permission values for the {@linkplain Workbasket Workbaskets}. */
public enum WorkbasketPermission {
READ,
READTASKS,
EDITTASKS,
OPEN,
APPEND,
TRANSFER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public interface WorkbasketAccessMapper {
@Result(property = "accessId", column = "ACCESS_ID")
@Result(property = "accessName", column = "ACCESS_NAME")
@Result(property = "permRead", column = "PERM_READ")
@Result(property = "permReadTasks", column = "PERM_READTASKS")
@Result(property = "permEditTasks", column = "PERM_EDITTASKS")
@Result(property = "permOpen", column = "PERM_OPEN")
@Result(property = "permAppend", column = "PERM_APPEND")
@Result(property = "permTransfer", column = "PERM_TRANSFER")
Expand All @@ -45,6 +47,8 @@ public interface WorkbasketAccessMapper {
@Result(property = "accessId", column = "ACCESS_ID")
@Result(property = "accessName", column = "ACCESS_NAME")
@Result(property = "permRead", column = "PERM_READ")
@Result(property = "permReadTasks", column = "PERM_READTASKS")
@Result(property = "permEditTasks", column = "PERM_EDITTASKS")
@Result(property = "permOpen", column = "PERM_OPEN")
@Result(property = "permAppend", column = "PERM_APPEND")
@Result(property = "permTransfer", column = "PERM_TRANSFER")
Expand All @@ -70,6 +74,8 @@ public interface WorkbasketAccessMapper {
@Result(property = "accessId", column = "ACCESS_ID")
@Result(property = "accessName", column = "ACCESS_NAME")
@Result(property = "permRead", column = "PERM_READ")
@Result(property = "permReadTasks", column = "PERM_READTASKS")
@Result(property = "permEditTasks", column = "PERM_EDITTASKS")
@Result(property = "permOpen", column = "PERM_OPEN")
@Result(property = "permAppend", column = "PERM_APPEND")
@Result(property = "permTransfer", column = "PERM_TRANSFER")
Expand Down Expand Up @@ -112,6 +118,8 @@ public interface WorkbasketAccessMapper {
@Result(property = "accessId", column = "ACCESS_ID")
@Result(property = "accessName", column = "ACCESS_NAME")
@Result(property = "permRead", column = "PERM_READ")
@Result(property = "permReadTasks", column = "PERM_READTASKS")
@Result(property = "permEditTasks", column = "PERM_EDITTASKS")
@Result(property = "permOpen", column = "PERM_OPEN")
@Result(property = "permAppend", column = "PERM_APPEND")
@Result(property = "permTransfer", column = "PERM_TRANSFER")
Expand All @@ -138,6 +146,8 @@ WorkbasketAccessItemImpl findByWorkbasketAndAccessId(
@Result(property = "accessId", column = "ACCESS_ID")
@Result(property = "accessName", column = "ACCESS_NAME")
@Result(property = "permRead", column = "PERM_READ")
@Result(property = "permReadTasks", column = "PERM_READTASKS")
@Result(property = "permEditTasks", column = "PERM_EDITTASKS")
@Result(property = "permOpen", column = "PERM_OPEN")
@Result(property = "permAppend", column = "PERM_APPEND")
@Result(property = "permTransfer", column = "PERM_TRANSFER")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class WorkbasketAccessSqlProvider {
private static final List<Pair<String, String>> PERMISSIONS =
Arrays.asList(
Pair.of("PERM_READ", "#{workbasketAccessItem.permRead}"),
Pair.of("PERM_READTASKS", "#{workbasketAccessItem.permReadTasks}"),
Pair.of("PERM_EDITTASKS", "#{workbasketAccessItem.permEditTasks}"),
Pair.of("PERM_OPEN", "#{workbasketAccessItem.permOpen}"),
Pair.of("PERM_APPEND", "#{workbasketAccessItem.permAppend}"),
Pair.of("PERM_TRANSFER", "#{workbasketAccessItem.permTransfer}"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class WorkbasketAccessItemImpl implements WorkbasketAccessItem {
private String accessId;
private String accessName;
private boolean permRead;
private boolean permReadTasks;
private boolean permEditTasks;
private boolean permOpen;
private boolean permAppend;
private boolean permTransfer;
Expand All @@ -39,6 +41,8 @@ private WorkbasketAccessItemImpl(WorkbasketAccessItemImpl copyFrom) {
accessId = copyFrom.accessId;
accessName = copyFrom.accessName;
permRead = copyFrom.permRead;
permReadTasks = copyFrom.permReadTasks;
permEditTasks = copyFrom.permEditTasks;
permOpen = copyFrom.permOpen;
permAppend = copyFrom.permAppend;
permTransfer = copyFrom.permTransfer;
Expand Down Expand Up @@ -109,6 +113,12 @@ public void setPermission(WorkbasketPermission permission, boolean value) {
case READ:
permRead = value;
break;
case READTASKS:
permReadTasks = value;
break;
case EDITTASKS:
permEditTasks = value;
break;
case OPEN:
permOpen = value;
break;
Expand Down Expand Up @@ -167,6 +177,10 @@ public boolean getPermission(WorkbasketPermission permission) {
switch (permission) {
case READ:
return permRead;
case READTASKS:
return permReadTasks;
case EDITTASKS:
return permEditTasks;
case OPEN:
return permOpen;
case APPEND:
Expand Down Expand Up @@ -212,6 +226,22 @@ public void setPermRead(boolean permRead) {
this.permRead = permRead;
}

public boolean isPermReadTasks() {
return permReadTasks;
}

public void setPermReadTasks(boolean permReadTasks) {
this.permReadTasks = permReadTasks;
}

public boolean isPermEditTasks() {
return permEditTasks;
}

public void setPermEditTasks(boolean permEditTasks) {
this.permEditTasks = permEditTasks;
}

public boolean isPermOpen() {
return permOpen;
}
Expand Down Expand Up @@ -354,6 +384,8 @@ public int hashCode() {
accessId,
accessName,
permRead,
permReadTasks,
permEditTasks,
permOpen,
permAppend,
permTransfer,
Expand Down Expand Up @@ -382,6 +414,8 @@ public boolean equals(Object obj) {
}
WorkbasketAccessItemImpl other = (WorkbasketAccessItemImpl) obj;
return permRead == other.permRead
&& permReadTasks == other.permReadTasks
&& permEditTasks == other.permEditTasks
&& permOpen == other.permOpen
&& permAppend == other.permAppend
&& permTransfer == other.permTransfer
Expand Down Expand Up @@ -417,6 +451,10 @@ public String toString() {
+ this.accessId
+ ", permRead="
+ this.permRead
+ ", permReadTasks="
+ this.permReadTasks
+ ", permEditTasks="
+ this.permEditTasks
+ ", permOpen="
+ this.permOpen
+ ", permAppend="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ void should_ReturnWorkbasketPermissions_When_IdIsValidAndUserHasPermissions() {
List<WorkbasketPermission> permissions =
WORKBASKET_SERVICE.getPermissionsForWorkbasket("WBI:100000000000000000000000000000000007");

assertThat(permissions).hasSize(4);
assertThat(permissions).hasSize(6);
assertThat(permissions.contains(WorkbasketPermission.READ)).isTrue();
assertThat(permissions.contains(WorkbasketPermission.OPEN)).isTrue();
assertThat(permissions.contains(WorkbasketPermission.TRANSFER)).isTrue();
assertThat(permissions.contains(WorkbasketPermission.APPEND)).isTrue();
assertThat(permissions.contains(WorkbasketPermission.READTASKS)).isTrue();
assertThat(permissions.contains(WorkbasketPermission.EDITTASKS)).isTrue();
}

@WithAccessId(user = "user-1-1")
Expand Down

0 comments on commit 7e218fb

Please sign in to comment.