Below is the example of using the SetMbSec operation to change user profile. The request contains the user and new parameters of his profile. The response contains the updated list of repository user profiles.
{
"SetMbSec" :
{
"tMbSec" :
{
"id" : "S1!M"
},
"tArg" :
{
"pattern" :
{
"users" : "Change",
"user" :
{
"profile" : "true"
}
},
"meta" :
{
"users" :
{
"its" :
{
"it" :
[
{
"k" : "2147483649",
"id" : "ADMIN",
"vis" : "true",
"type" : "User",
"sid" :
{
"sid" : "PS-1-1",
"type" : "User"
},
"data" :
{
"desc" : " ",
"memberOf" :
{
"its" :
{
"it" :
[
{
"k" : "2147483649",
"id" : "ADMINISTRATORS",
"n" : "ADMINISTRATORS",
"vis" : "true",
"type" : "Group",
"sid" :
{
"sid" : "PS-2-1",
"type" : "Group"
}
}
]
}
},
"isNT" : "false",
"isExternal" : "false",
"isBuiltin" : "true",
"user" :
{
"mustChangePasswordAtNextLogon" : "false",
"cannotChangePassword" : "false",
"lockedState" : "NotLocked",
"manageDBGrants" : "true",
"maxLogonSessions" : "0",
"lastLoginStamp" : "2018-10-24T11:31:20.847",
"hasAccessToRepository" : "true",
"isAdmin" : "true",
"isIsa" : "false",
"isRoled" : "false",
"changePassStamp" : "2018-10-24T06:31:43",
"autoRun" : "",
"temporaryAge" : "0",
"eternalPass" : "false",
"certificate" : ""
}
},
"profile" :
{
"k" : "0",
"sid" :
{
"sid" : "PS-1-1",
"type" : "User"
},
"emails" :
{
"its" : "",
"work" :
{
"name" : "Work",
"email" : "NewWork@example.ru"
},
"personal" :
{
"name" : "Personal",
"email" : "NewHome@example.ru"
},
"mobile" :
{
"name" : "Mobile",
"email" : "NewMobile@example.ru"
}
},
"props" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"id" : "Location",
"value" : "Home"
}
]
}
}
}
}
]
}
}
},
"metaGet" :
{
"pattern" :
{
"profiles" : "Get"
}
}
}
}
}
{
"SetMbSecResult" :
{
"id" :
{
"id" : "S1!M"
},
"metaGet" :
{
"id" :
{
"id" : "S1!M"
},
"meta" :
{
"profiles" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"id" : "PS-1-1",
"n" : "ADMIN",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-1"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Work",
"email" : "NewWork@example.ru"
},
{
"name" : "Mobile",
"email" : "NewMobile@example.ru"
},
{
"name" : "Personal",
"email" : "NewHome@example.ru"
}
]
},
"def" :
{
"name" : "Work",
"email" : "NewWork@example.ru"
},
"work" :
{
"name" : "Work",
"email" : "NewWork@example.ru"
},
"personal" :
{
"name" : "Personal",
"email" : "NewHome@example.ru"
},
"mobile" :
{
"name" : "Mobile",
"email" : "NewMobile@example.ru"
}
},
"props" :
{
"its" :
{
"it" :
[
{
"k" : "1",
"id" : "Location",
"value" : "Home",
"dt" : "1"
}
]
}
}
},
{
"k" : "0",
"id" : "PS-1-532",
"n" : "GUEST",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-532"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Work",
"email" : ""
},
{
"name" : "Mobile",
"email" : ""
},
{
"name" : "Personal",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
},
{
"k" : "0",
"id" : "PS-1-537",
"n" : "NEWADMIN",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-537"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Work",
"email" : ""
},
{
"name" : "Mobile",
"email" : ""
},
{
"name" : "Personal",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
},
{
"k" : "0",
"id" : "PS-1-539",
"n" : "NEWADMIN",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-539"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Work",
"email" : ""
},
{
"name" : "Mobile",
"email" : ""
},
{
"name" : "Personal",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
},
{
"k" : "0",
"id" : "PS-1-541",
"n" : "NEWADMIN",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-541"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Work",
"email" : ""
},
{
"name" : "Mobile",
"email" : ""
},
{
"name" : "Personal",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
},
{
"k" : "0",
"id" : "PS-1-543",
"n" : "NEWADMIN",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-543"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Work",
"email" : ""
},
{
"name" : "Mobile",
"email" : ""
},
{
"name" : "Personal",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
},
{
"k" : "0",
"id" : "PS-1-545",
"n" : "NEWADMIN",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-545"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Work",
"email" : ""
},
{
"name" : "Mobile",
"email" : ""
},
{
"name" : "Personal",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
},
{
"k" : "0",
"id" : "S-1-5-21-2210245889-1953428358-4221806923-2817",
"n" : "FS\ASBADMIN",
"vis" : "1",
"sid" :
{
"sid" : "S-1-5-21-2210245889-1953428358-4221806923-2817"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Work",
"email" : ""
},
{
"name" : "Mobile",
"email" : ""
},
{
"name" : "Personal",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
}
]
}
},
"bisearchEnable" : "Disable"
}
}
}
}
public static SetMbSecResult ChangeUserProfile(string mb, MbSubject user)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Change specified user profile
user.profile = new MbSecProfile()
{
sid = user.sid,
emails = new MbSecProfileEmails()
{
its = new MbSecProfileEmail[3],
mobile = new MbSecProfileEmail() { name = "Mobile", email = "NewMobile@example.ru" },
personal = new MbSecProfileEmail() { name = "Personal", email = "NewHome@example.ru" },
work = new MbSecProfileEmail() { name = "Work", email = "NewWork@example.ru" }
},
props = new MbSecProfileProps()
{
its = new MbSecProfileProp[1]
{
new MbSecProfileProp() { id = "Location", value = "Home"}
}
}
};
//Operation execution parameters
var setMbSec = new SetMbSec()
{
tArg = new SetMbSecArg()
{
pattern = new MbSecMdPattern()
{
users = ListOperation.Change,
user = new MbSubjectPattern()
{
profile = true
}
},
meta = new MbSecMd()
{
users = new MbSubjects()
{
its = new MbSubject[1]
{
user
}
}
},
metaGet = new GetMbSecArg()
{
pattern = new MbSecMdPattern()
{
profiles = ListOperation.Get
}
}
},
tMbSec = new MbId() { id = mb }
};
//Change user profile
var result = somClient.SetMbSec(setMbSec);
return result;
}
See also: