Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide default users from groups, Cosmatic bugs #1353

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/components/govuk-radio/govuk-radio.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="govuk-form-group">
<fieldset class="govuk-fieldset">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
<legend class="govuk-heading-s">
{{ details.title }}
</legend>
<p *ngIf="details.description">
Expand Down
8 changes: 4 additions & 4 deletions src/app/components/govuk-radio/govuk-radio.component.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
legend {
font-size: 19px;
}
.description_para {
position: relative;
left: 16px;
Expand All @@ -13,5 +10,8 @@ legend {
left: 16px;
}
label {
font-weight: bold;
font-weight: bold;
}
.govuk-heading-s{
font-family: Source Sans Pro !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ export class ManageUserAddSingleUserDetailComponent
}
this.userTypeDetails.selectedValue = this.isAdminUser ? 'ORG_ADMINISTRATOR' : 'ORG_DEFAULT_USER';
this.oldSelectedUserType = this.isAdminUser ? 'ORG_ADMINISTRATOR' : 'ORG_DEFAULT_USER';
this.removeDefaultUserRoleFromServiceRole();
}

private patchAdminMailData() {
Expand Down Expand Up @@ -1031,4 +1032,15 @@ private GetAssignedGroups(isGroupOfUser:any,group:any){
this.isFormUserTypeChanges = false;
}
}

private removeDefaultUserRoleFromServiceRole(){
let defaultUserRoleId = this.userTypeDetails.data.filter(x => x.key === 'ORG_DEFAULT_USER')[0].id;
this.groupsMember.data.forEach(grp => {
grp.serviceRoleGroups = grp.serviceRoleGroups.filter((item: any) => item.id !== defaultUserRoleId);
});
this.noneGroupsMember.data.forEach(grp => {
grp.serviceRoleGroups = grp.serviceRoleGroups.filter((item: any) => item.id !== defaultUserRoleId);
});
this.orgUserGroupRoles = this.orgUserGroupRoles.filter((item: any) => item.id !== defaultUserRoleId);
}
}
16 changes: 14 additions & 2 deletions src/app/pages/user-profile/user-profile-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit {
orgRoles.forEach((role: any) => {
if (role.roleKey === this.userRoleKey || role.roleKey === this.adminRoleKey) {
this.userTypeDetails.data.push({
id: role.roleId,
key: role.roleKey,
name: role.roleName,
description: role.description
Expand All @@ -247,7 +248,7 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit {
}
this.userTypeDetails.isGrayOut = true;
this.userTypeDetails.selectedValue = this.isAdminUser ? this.adminRoleKey : this.userRoleKey;
this.userTypeDetails.description = this.isAdminUser ? 'Only another administrators can change your user type' : 'Only administrators can change your user type';
this.userTypeDetails.description = this.isAdminUser ? 'Only another administrator can change your user type.' : 'Only an administrator can change your user type.';

//bind Roles based on User Type
if (this.isAdminUser == true) {
Expand Down Expand Up @@ -364,7 +365,7 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit {
'Send messages to multiple contacts in your organisation. You can also send targeted communications to specific users.',
];
}

this.removeDefaultUserRoleFromServiceRole();
}


Expand Down Expand Up @@ -825,4 +826,15 @@ export class UserProfileComponent extends FormBaseComponent implements OnInit {
public onUserTypeChanged(event:any){
console.log("evesssnt",event)
}

private removeDefaultUserRoleFromServiceRole(){
let defaultUserRoleId = this.userTypeDetails.data.filter(x => x.key === 'ORG_DEFAULT_USER')[0].id;
this.groupsMember.data.forEach(grp => {
grp.serviceRoleGroups = grp.serviceRoleGroups.filter((item: any) => item.id !== defaultUserRoleId);
});
this.noneGroupsMember.data.forEach(grp => {
grp.serviceRoleGroups = grp.serviceRoleGroups.filter((item: any) => item.id !== defaultUserRoleId);
});
this.orgUserGroupRoles = this.orgUserGroupRoles.filter((item: any) => item.id !== defaultUserRoleId);
}
}