users change by sriram
This commit is contained in:
parent
c20f12430c
commit
b3602987c2
@ -413,27 +413,19 @@ export class AwsService {
|
||||
this.getconfig();
|
||||
|
||||
//let cognitodata = "539bfefa-ae42-4bee-bf79-4b15d1a2af7f";
|
||||
if(userData.userid === null ){
|
||||
for(let role of userData.role){
|
||||
|
||||
|
||||
|
||||
let params: any;
|
||||
if (userData.type.entity_type_id == 1) {
|
||||
|
||||
|
||||
params = {
|
||||
GroupName: role.GroupName /* required */,
|
||||
GroupName: "ADMIN" /* required */,
|
||||
UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||
Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||
};
|
||||
|
||||
} else if (userData.type.entity_type_id == 2) {
|
||||
params = {
|
||||
GroupName: role.GroupName /* required */,
|
||||
UserPoolId: lender_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||
Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
//(params);
|
||||
return Observable.create(observe=>{
|
||||
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||
@ -454,50 +446,9 @@ export class AwsService {
|
||||
|
||||
})
|
||||
});
|
||||
}
|
||||
}else{
|
||||
let params :any;
|
||||
console.log(userData);
|
||||
console.log(cognitodata);
|
||||
if (userData.fk_entity_id == 1) {
|
||||
|
||||
params = {
|
||||
GroupName: cognitodata.GroupName /* required */,
|
||||
UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||
Username: userData.aws_name //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||
};
|
||||
|
||||
} else if (userData.fk_entity_id == 2) {
|
||||
params = {
|
||||
GroupName: cognitodata.GroupName /* required */,
|
||||
UserPoolId: lender_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||
Username: userData.aws_name //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
//(params);
|
||||
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||
|
||||
cognitoidentityserviceprovider.adminAddUserToGroup(params, function (
|
||||
err,
|
||||
data
|
||||
) {
|
||||
if (err) {
|
||||
alert(err.message);
|
||||
}//(err, err.stack);
|
||||
// an error occurred
|
||||
else {//(data);
|
||||
|
||||
console.log(data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -88,12 +88,6 @@ export class RegisterComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
onSelect(e){
|
||||
// alert();
|
||||
// console.log(e)
|
||||
// console.log(e.isUserInput);
|
||||
// console.log(this.regForm.controls['role'].value);
|
||||
}
|
||||
|
||||
regdata() {
|
||||
this.users.entityType().subscribe(res => {
|
||||
@ -172,7 +166,7 @@ export class RegisterComponent implements OnInit {
|
||||
|
||||
|
||||
register(userData) {
|
||||
// console.log(userData);
|
||||
console.log(userData);
|
||||
let data:any;
|
||||
|
||||
// console.log(this.files);
|
||||
@ -193,7 +187,7 @@ this.loader = true;
|
||||
|
||||
this.AWS.register(userData).subscribe(res => {
|
||||
if (res.User.UserStatus != '' && res.User.UserStatus !== undefined && res.User.UserStatus != null) {
|
||||
if(userData.role == 'System Administrator'){
|
||||
if(userData.role.role_id == 10){
|
||||
this.AWS.UserGroup(res,userData).subscribe(res=>{
|
||||
});}
|
||||
this.users.saveRecords(res, userData).subscribe(res => {
|
||||
@ -212,6 +206,9 @@ this.loader = true;
|
||||
});
|
||||
} else {
|
||||
this.AWS.adminchangeData(this.usersData,userData).subscribe(res=>{
|
||||
if(userData.role.role_id == 10){
|
||||
this.AWS.UserGroup(res,userData).subscribe(res=>{
|
||||
});}
|
||||
this.users.saveRecords(res,userData).subscribe(res=>{
|
||||
this.loader = false;
|
||||
alert('Update User');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user