WIP mifosx-126 remove group-enum from m_permission and add grouping and order_in_grouping columns
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE m_permission
|
||||
DROP COLUMN `group_enum` ,
|
||||
ADD COLUMN `grouping` VARCHAR(45) NULL AFTER `id` ,
|
||||
ADD COLUMN `order_in_grouping` INT NULL AFTER `grouping` ,
|
||||
ADD UNIQUE INDEX `code` (`code` ASC) ;
|
||||
+5
-5
@@ -114,29 +114,29 @@ public class ReadWriteNonCoreDataServiceImpl implements
|
||||
|
||||
genericDataService.updateSQL(sql, "SQL: " + sql);
|
||||
|
||||
sql = "insert into m_permission (group_enum, code, default_description, default_name) values "
|
||||
+ "(3, "
|
||||
sql = "insert into m_permission (grouping, code, default_description, default_name) values "
|
||||
+ "('datatable', "
|
||||
+ createPermission
|
||||
+ ", "
|
||||
+ createPermission
|
||||
+ ", "
|
||||
+ createPermission
|
||||
+ "),"
|
||||
+ "(3, "
|
||||
+ "('datatable', "
|
||||
+ readPermission
|
||||
+ ", "
|
||||
+ readPermission
|
||||
+ ", "
|
||||
+ readPermission
|
||||
+ "),"
|
||||
+ "(3, "
|
||||
+ "('datatable', "
|
||||
+ updatePermission
|
||||
+ ", "
|
||||
+ updatePermission
|
||||
+ ", "
|
||||
+ updatePermission
|
||||
+ "),"
|
||||
+ "(3, "
|
||||
+ "('datatable', "
|
||||
+ deletePermission
|
||||
+ ", "
|
||||
+ deletePermission + ", " + deletePermission + ")";
|
||||
|
||||
@@ -13,6 +13,12 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
|
||||
@Table(name = "m_permission")
|
||||
public class Permission extends AbstractPersistable<Long> {
|
||||
|
||||
@Column(name = "grouping", nullable = false, length=45)
|
||||
private final String grouping;
|
||||
|
||||
@Column(name = "order_in_grouping", nullable = false)
|
||||
private final Integer orderInGrouping;
|
||||
|
||||
@Column(name = "code", nullable = false, length=100)
|
||||
private final String code;
|
||||
|
||||
@@ -22,23 +28,19 @@ public class Permission extends AbstractPersistable<Long> {
|
||||
@Column(name = "default_description", nullable = false, length=500)
|
||||
private final String defaultDescription;
|
||||
|
||||
// TODO - KW - do we need to retain this concept?
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "group_enum", nullable = false)
|
||||
@Enumerated(EnumType.ORDINAL)
|
||||
private final PermissionGroup permissionGroup;
|
||||
|
||||
public Permission() {
|
||||
this.grouping = null;
|
||||
this.orderInGrouping = null;
|
||||
this.code = null;
|
||||
this.defaultDescription = null;
|
||||
this.defaultName = null;
|
||||
this.permissionGroup = null;
|
||||
}
|
||||
|
||||
public Permission(final String code, final String defaultDescription, final String defaultName, final PermissionGroup permissionGroup) {
|
||||
//TODO - This constructor probably not used in app (JPW)
|
||||
public Permission(final String code, final String defaultDescription, final String defaultName) {
|
||||
this.grouping = "";
|
||||
this.orderInGrouping = 0;
|
||||
this.code = code;
|
||||
this.defaultDescription = defaultDescription;
|
||||
this.permissionGroup = permissionGroup;
|
||||
this.defaultName = defaultName;
|
||||
}
|
||||
|
||||
|
||||
+1
-31
@@ -5,18 +5,15 @@ public class PermissionBuilder {
|
||||
private String code;
|
||||
private String name;
|
||||
private String description;
|
||||
private PermissionGroup permissionGroup;
|
||||
|
||||
public Permission build() {
|
||||
return new Permission(this.code, this.description, this.name,
|
||||
this.permissionGroup);
|
||||
return new Permission(this.code, this.description, this.name);
|
||||
}
|
||||
|
||||
public PermissionBuilder userCreation() {
|
||||
this.code = "CAN_CREATE_APPLICATION_USER_ROLE";
|
||||
this.name = "User Creation";
|
||||
this.description = "Allows an application user to create other users for the application.";
|
||||
this.permissionGroup = PermissionGroup.USER_ADMINISTRATION;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -24,7 +21,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_CREATE_APPLICATION_ROLE_ROLE";
|
||||
this.name = "Role Creation";
|
||||
this.description = "Allows an application user to create other application roles for assigning to users.";
|
||||
this.permissionGroup = PermissionGroup.USER_ADMINISTRATION;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -32,7 +28,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_VIEW_USERS_AND_ROLES_ROLE";
|
||||
this.name = "View users and roles";
|
||||
this.description = "Allows an application user to view other application users and roles in their organisation.";
|
||||
this.permissionGroup = PermissionGroup.USER_ADMINISTRATION;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -40,7 +35,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_UPDATE_APPLICATION_PERMISSION_NAMES_AND_DESCRIPTIONS_ROLE";
|
||||
this.name = "Update name and descriptions of application permissions";
|
||||
this.description = "Allows an application user to update the names and description of application permissions for their organisation.";
|
||||
this.permissionGroup = PermissionGroup.USER_ADMINISTRATION;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -48,7 +42,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_VIEW_ORGANISATION_WIDE_VIEW_OF_OFFICES_STAFF_AND_PRODUCTS_ROLE";
|
||||
this.name = "View organisations offices, staff and products";
|
||||
this.description = "Allows an application user to view all offices, staff and products for their organisation.";
|
||||
this.permissionGroup = PermissionGroup.ORGANISATION_ADMINISTRATION;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -56,7 +49,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_ADD_OFFICE_ROLE";
|
||||
this.name = "Add offices";
|
||||
this.description = "Allows an application user add new offices for their organisation.";
|
||||
this.permissionGroup = PermissionGroup.ORGANISATION_ADMINISTRATION;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -64,7 +56,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_ADD_STAFF_ROLE";
|
||||
this.name = "Add staff";
|
||||
this.description = "Allows an application user add new staff members for their organisation.";
|
||||
this.permissionGroup = PermissionGroup.ORGANISATION_ADMINISTRATION;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -72,7 +63,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_ADD_LOAN_PRODUCT_ROLE";
|
||||
this.name = "Add loan product";
|
||||
this.description = "Allows an application user add new loan products for their organisation.";
|
||||
this.permissionGroup = PermissionGroup.ORGANISATION_ADMINISTRATION;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -80,7 +70,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_VIEW_LOAN_PORTFOLIO_ROLE";
|
||||
this.name = "View client, group and loan information";
|
||||
this.description = "Allows an application user to view client, group and loan information for their organisation.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -88,7 +77,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_ADD_LOAN_ROLE";
|
||||
this.name = "Add loan.";
|
||||
this.description = "Allows an application user to add a loan.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -96,7 +84,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_ADD_BACKDATED_LOAN_ROLE";
|
||||
this.name = "Add backdated loan.";
|
||||
this.description = "Allows an application user to add a loan where the submitted on date is in the past.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -104,7 +91,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_APPROVE_LOAN_ROLE";
|
||||
this.name = "Approve loan.";
|
||||
this.description = "Allows an application user to approve a loan.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -112,7 +98,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_APPROVE_LOAN_IN_THE_PAST_ROLE";
|
||||
this.name = "Approve loan with date in past.";
|
||||
this.description = "Allows an application user to approve a loan with a date in the past.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -120,7 +105,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_REJECT_LOAN_ROLE";
|
||||
this.name = "Reject loan.";
|
||||
this.description = "Allows an application user to reject the loan application.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -128,7 +112,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_REJECT_LOAN_IN_THE_PAST_ROLE";
|
||||
this.name = "Reject loan with date in past.";
|
||||
this.description = "Allows an application user to reject the loan application with a date in the past.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -136,7 +119,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_WITHDRAW_LOAN_ROLE";
|
||||
this.name = "Withdraw loan.";
|
||||
this.description = "Allows an application user to withdraw the loan application.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -144,7 +126,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_WITHDRAW_LOAN_IN_THE_PAST_ROLE";
|
||||
this.name = "Withdraw loan with date in past.";
|
||||
this.description = "Allows an application user to withraw the loan application with a date in the past.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -152,7 +133,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_UNDO_LOAN_APPROVAL_ROLE";
|
||||
this.name = "Undo loan approval.";
|
||||
this.description = "Allows an application user to undo a loan approval.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -160,7 +140,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_DISBURSE_LOAN_ROLE";
|
||||
this.name = "Disburse loan.";
|
||||
this.description = "Allows an application user to disburse the loan.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -168,7 +147,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_DISBURSE_LOAN_IN_THE_PAST_ROLE";
|
||||
this.name = "Disburse loan with date in past.";
|
||||
this.description = "Allows an application user to disburse the loan with a date in the past.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -176,7 +154,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_UNDO_LOAN_DISBURSAL_ROLE";
|
||||
this.name = "Undo loan disbursal.";
|
||||
this.description = "Allows an application user to undo a loan disbursal (if no payments already made).";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -184,7 +161,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_MAKE_LOAN_REPAYMENT_ROLE";
|
||||
this.name = "Make loan repayment.";
|
||||
this.description = "Allows an application user to make a repayment against a loan.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -192,7 +168,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_MAKE_LOAN_REPAYMENT_IN_THE_PAST_ROLE";
|
||||
this.name = "Make loan repayment with date in past.";
|
||||
this.description = "Allows an application user to disburse the loan with a date in the past.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -200,7 +175,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_WRITEOFF_LOAN_ROLE";
|
||||
this.name = "Write off loan.";
|
||||
this.description = "Allows an application user to write off the loan application.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -208,7 +182,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_WRITEOFF_LOAN_IN_THE_PAST_ROLE";
|
||||
this.name = "Write off loan with date in past.";
|
||||
this.description = "Allows an application user to write off the loan application with a date in the past.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -216,7 +189,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_RESCHEDULE_LOAN_ROLE";
|
||||
this.name = "Reschedule loan.";
|
||||
this.description = "Allows an application user to reschedule the loan application.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -224,7 +196,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_RESCHEDULE_LOAN_IN_THE_PAST_ROLE";
|
||||
this.name = "Reschedule loan with date in past.";
|
||||
this.description = "Allows an application user to reschedule the loan application with a date in the past.";
|
||||
this.permissionGroup = PermissionGroup.PORTFOLIO_MANAGEMENT;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -232,7 +203,6 @@ public class PermissionBuilder {
|
||||
this.code = "CAN_MIGRATE_DATA_ROLE";
|
||||
this.name = "Upload client, group and loan data onto application in bulk";
|
||||
this.description = "Allows an application user to upload client, group and loan information in bulk for their organisation.";
|
||||
this.permissionGroup = PermissionGroup.DATA_MIGRATION;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package org.mifosng.platform.user.domain;
|
||||
|
||||
public enum PermissionGroup {
|
||||
INVALID, USER_ADMINISTRATION, ORGANISATION_ADMINISTRATION, PORTFOLIO_MANAGEMENT, REPORTING, DATA_MIGRATION;
|
||||
}
|
||||
+1
-2
@@ -45,13 +45,12 @@ public class PermissionReadPlatformServiceImpl implements PermissionReadPlatform
|
||||
String name = rs.getString("name");
|
||||
String description = rs.getString("description");
|
||||
String code = rs.getString("code");
|
||||
// Integer groupType = JdbcSupport.getInteger(rs, "groupType");
|
||||
|
||||
return new PermissionData(id, name, description, code);
|
||||
}
|
||||
|
||||
public String schema() {
|
||||
return " p.id as id, p.default_name as name, p.default_description as description, p.code as code, p.group_enum as groupType from m_permission p ";
|
||||
return " p.id as id, p.default_name as name, p.default_description as description, p.code as code from m_permission p ";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user