Changing User Profile

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.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetMbSec xmlns="http://www.prognoz.ru/PP.SOM.Som">
<tMbSec xmlns=" ">
  <id>S1!M</id>
  </tMbSec>
<tArg xmlns=" ">
<pattern>
  <users>Change</users>
<user>
  <profile>true</profile>
  </user>
  </pattern>
<meta>
<users>
<its>
<it>
  <k>2147483649</k>
  <id>ADMIN</id>
  <vis>true</vis>
  <type>User</type>
<sid>
  <sid>PS-1-1</sid>
  <type>User</type>
  </sid>
<data>
  <desc />
<memberOf>
<its>
<it>
  <k>2147483649</k>
  <id>ADMINISTRATORS</id>
  <n>ADMINISTRATORS</n>
  <vis>true</vis>
  <type>Group</type>
<sid>
  <sid>PS-2-1</sid>
  <type>Group</type>
  </sid>
  </it>
  </its>
  </memberOf>
  <isNT>false</isNT>
  <isExternal>false</isExternal>
  <isBuiltin>true</isBuiltin>
<user>
  <mustChangePasswordAtNextLogon>false</mustChangePasswordAtNextLogon>
  <cannotChangePassword>false</cannotChangePassword>
  <lockedState>NotLocked</lockedState>
  <manageDBGrants>true</manageDBGrants>
  <maxLogonSessions>0</maxLogonSessions>
  <lastLoginStamp>2018-10-24T11:31:20.847</lastLoginStamp>
  <hasAccessToRepository>true</hasAccessToRepository>
  <isAdmin>true</isAdmin>
  <isIsa>false</isIsa>
  <isRoled>false</isRoled>
  <changePassStamp>2018-10-24T06:31:43</changePassStamp>
  <autoRun />
  <temporaryAge>0</temporaryAge>
  <eternalPass>false</eternalPass>
  <certificate />
  </user>
  </data>
<profile>
  <k>0</k>
<sid>
  <sid>PS-1-1</sid>
  <type>User</type>
  </sid>
<emails>
  <its />
<work>
  <name>Work</name>
  <email>NewWork@example.ru</email>
  </work>
<personal>
  <name>Personal</name>
  <email>NewHome@example.ru</email>
  </personal>
<mobile>
  <name>Mobile</name>
  <email>NewMobile@example.ru</email>
  </mobile>
  </emails>
<props>
<its>
<it>
  <k>0</k>
  <id>Location</id>
  <value>Home</value>
  </it>
  </its>
  </props>
  </profile>
  </it>
  </its>
  </users>
  </meta>
<metaGet>
<pattern>
  <profiles>Get</profiles>
  </pattern>
  </metaGet>
  </tArg>
  </SetMbSec>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetMbSecResult xmlns="http://www.prognoz.ru/PP.SOM.Som" xmlns:q1="http://www.prognoz.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns=" ">
  <id>S1!M</id>
  </id>
<metaGet xmlns=" ">
<id>
  <id>S1!M</id>
  </id>
<meta>
<profiles>
<its>
<it>
  <k>0</k>
  <id>PS-1-1</id>
  <n>ADMIN</n>
  <vis>1</vis>
<sid>
  <sid>PS-1-1</sid>
  </sid>
<emails>
<its>
<it>
  <name>Work</name>
  <email>NewWork@example.ru</email>
  </it>
<it>
  <name>Mobile</name>
  <email>NewMobile@example.ru</email>
  </it>
<it>
  <name>Personal</name>
  <email>NewHome@example.ru</email>
  </it>
  </its>
<def>
  <name>Work</name>
  <email>NewWork@example.ru</email>
  </def>
<work>
  <name>Work</name>
  <email>NewWork@example.ru</email>
  </work>
<personal>
  <name>Personal</name>
  <email>NewHome@example.ru</email>
  </personal>
<mobile>
  <name>Mobile</name>
  <email>NewMobile@example.ru</email>
  </mobile>
  </emails>
<props>
<its>
<it>
  <k>1</k>
  <id>Location</id>
  <value>Home</value>
  <dt>1</dt>
  </it>
  </its>
  </props>
  </it>
<it>
  <k>0</k>
  <id>PS-1-532</id>
  <n>GUEST</n>
  <vis>1</vis>
<sid>
  <sid>PS-1-532</sid>
  </sid>
<emails>
<its>
<it>
  <name>Work</name>
  <email />
  </it>
<it>
  <name>Mobile</name>
  <email />
  </it>
<it>
  <name>Personal</name>
  <email />
  </it>
  </its>
  </emails>
<props>
  <its />
  </props>
  </it>
<it>
  <k>0</k>
  <id>PS-1-537</id>
  <n>NEWADMIN</n>
  <vis>1</vis>
<sid>
  <sid>PS-1-537</sid>
  </sid>
<emails>
<its>
<it>
  <name>Work</name>
  <email />
  </it>
<it>
  <name>Mobile</name>
  <email />
  </it>
<it>
  <name>Personal</name>
  <email />
  </it>
  </its>
  </emails>
<props>
  <its />
  </props>
  </it>
<it>
  <k>0</k>
  <id>PS-1-539</id>
  <n>NEWADMIN</n>
  <vis>1</vis>
<sid>
  <sid>PS-1-539</sid>
  </sid>
<emails>
<its>
<it>
  <name>Work</name>
  <email />
  </it>
<it>
  <name>Mobile</name>
  <email />
  </it>
<it>
  <name>Personal</name>
  <email />
  </it>
  </its>
  </emails>
<props>
  <its />
  </props>
  </it>
<it>
  <k>0</k>
  <id>PS-1-541</id>
  <n>NEWADMIN</n>
  <vis>1</vis>
<sid>
  <sid>PS-1-541</sid>
  </sid>
<emails>
<its>
<it>
  <name>Work</name>
  <email />
  </it>
<it>
  <name>Mobile</name>
  <email />
  </it>
<it>
  <name>Personal</name>
  <email />
  </it>
  </its>
  </emails>
<props>
  <its />
  </props>
  </it>
<it>
  <k>0</k>
  <id>PS-1-543</id>
  <n>NEWADMIN</n>
  <vis>1</vis>
<sid>
  <sid>PS-1-543</sid>
  </sid>
<emails>
<its>
<it>
  <name>Work</name>
  <email />
  </it>
<it>
  <name>Mobile</name>
  <email />
  </it>
<it>
  <name>Personal</name>
  <email />
  </it>
  </its>
  </emails>
<props>
  <its />
  </props>
  </it>
<it>
  <k>0</k>
  <id>PS-1-545</id>
  <n>NEWADMIN</n>
  <vis>1</vis>
<sid>
  <sid>PS-1-545</sid>
  </sid>
<emails>
<its>
<it>
  <name>Work</name>
  <email />
  </it>
<it>
  <name>Mobile</name>
  <email />
  </it>
<it>
  <name>Personal</name>
  <email />
  </it>
  </its>
  </emails>
<props>
  <its />
  </props>
  </it>
<it>
  <k>0</k>
  <id>S-1-5-21-2210245889-1953428358-4221806923-2817</id>
  <n>FS\ASBADMIN</n>
  <vis>1</vis>
<sid>
  <sid>S-1-5-21-2210245889-1953428358-4221806923-2817</sid>
  </sid>
<emails>
<its>
<it>
  <name>Work</name>
  <email />
  </it>
<it>
  <name>Mobile</name>
  <email />
  </it>
<it>
  <name>Personal</name>
  <email />
  </it>
  </its>
  </emails>
<props>
  <its />
  </props>
  </it>
  </its>
  </profiles>
  <bisearchEnable>Disable</bisearchEnable>
  </meta>
  </metaGet>
  </SetMbSecResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"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"
}
}
}
}
}

JSON response:

{
"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:

SetMbSec: Operation