Adding default flag to the group domain object so that the client can select a default permission group for the user.

This commit is contained in:
Arpit Mohan 2020-01-03 10:05:51 +00:00
parent 045f1f31d7
commit b8bc4514ba
3 changed files with 41 additions and 1 deletions

View File

@ -30,6 +30,8 @@ public class Group extends BaseDomain {
*/ */
Set<String> permissions; Set<String> permissions;
private Boolean isDefault = false;
/** /**
* If the display name is null or empty, then just return the actual group name. This is just to ensure that * If the display name is null or empty, then just return the actual group name. This is just to ensure that
* the client is never sent an empty group name for displaying on the UI. * the client is never sent an empty group name for displaying on the UI.

View File

@ -55,6 +55,7 @@ public class GroupServiceImpl extends BaseService<GroupRepository, Group, String
newGroup.setDisplayName(group.getDisplayName()); newGroup.setDisplayName(group.getDisplayName());
newGroup.setOrganizationId(organizationId); newGroup.setOrganizationId(organizationId);
newGroup.setPermissions(group.getPermissions()); newGroup.setPermissions(group.getPermissions());
newGroup.setIsDefault(group.getIsDefault());
log.debug("Creating group {} for org: {}", group.getName(), organizationId); log.debug("Creating group {} for org: {}", group.getName(), organizationId);
return create(newGroup); return create(newGroup);
}); });

View File

@ -50,6 +50,8 @@ let res = [
"_id": ObjectId("5da151714a020300041ae8ff"), "_id": ObjectId("5da151714a020300041ae8ff"),
"name": "org-admin", "name": "org-admin",
"organizationId": "5da151714a020300041ae8fd", "organizationId": "5da151714a020300041ae8fd",
"displayName": "Org Admin Group",
"isDefault": true,
"permissions": [ "permissions": [
"read:groups", "read:groups",
"read:organizations", "read:organizations",
@ -78,7 +80,42 @@ let res = [
], ],
"deleted": false, "deleted": false,
"_class": "com.appsmith.server.domains.Group" "_class": "com.appsmith.server.domains.Group"
}), },
{
"_id": ObjectId("5df8c1e0078d501fc3f4491b"),
"name": "org-admin",
"organizationId": "default-org",
"displayName": "Org Admin Group",
"isDefault": true,
"permissions": [
"read:groups",
"read:organizations",
"create:users",
"create:groups",
"create:organizations",
"read:users",
"read:pages",
"create:pages",
"update:pages",
"read:layouts",
"create:layouts",
"update:layouts",
"read:properties",
"create:properties",
"update:properties",
"read:actions",
"create:actions",
"update:actions",
"read:resources",
"create:resources",
"update:resources",
"read:plugins",
"create:plugins",
"update:plugins"
],
"deleted": false,
"_class": "com.appsmith.server.domains.Group"
}),
db.user.insert({ db.user.insert({
"name": "Admin User", "name": "Admin User",