Changing User Parameters

Below is the example of using the SetMbSec operation to change user parameters. The request contains a new user password and a group, to which the user is included. The response contains the updated list of repository users.

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>
  <data>true</data>
  <memberOf>Set</memberOf>
  </user>
  </pattern>
<meta>
<users>
<its>
<it>
  <k>18446744073709551615</k>
  <id>NewAdmin</id>
  <vis>true</vis>
  <type>User</type>
<sid>
  <sid />
  </sid>
<data>
<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>
<data>
  <desc>Built-in group of administrators</desc>
  <isNT>false</isNT>
  <isExternal>true</isExternal>
  <isBuiltin>true</isBuiltin>
<group>
<members>
<its>
<it>
  <k>2147483649</k>
  <id>ADMIN</id>
  <vis>true</vis>
  <type>User</type>
<sid>
  <sid>PS-1-1</sid>
  <type>User</type>
  </sid>
  </it>
  </its>
  </members>
  <hasAccessToken>false</hasAccessToken>
  </group>
  </data>
  </it>
  </its>
  </memberOf>
<user>
<credentials>
  <pass>q1</pass>
  </credentials>
<oldCredentials>
  <pass>NewAdmin</pass>
  </oldCredentials>
  </user>
  </data>
  </it>
  </its>
  </users>
  </meta>
<metaGet>
<pattern>
  <users>Get</users>
  </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>
<users>
<its>
<it>
  <k>2147483649</k>
  <id>ADMIN</id>
  <vis>1</vis>
  <type>User</type>
<sid>
  <sid>PS-1-1</sid>
  <type>User</type>
  </sid>
<data>
  <desc />
  <isNT>0</isNT>
  <isExternal>0</isExternal>
  <isBuiltin>1</isBuiltin>
<user>
  <mustChangePasswordAtNextLogon>0</mustChangePasswordAtNextLogon>
  <cannotChangePassword>0</cannotChangePassword>
  <lockedState>NotLocked</lockedState>
  <manageDBGrants>1</manageDBGrants>
  <maxLogonSessions>0</maxLogonSessions>
  <lastLoginStamp>2018-10-24T11:31:20.847</lastLoginStamp>
  <hasAccessToRepository>1</hasAccessToRepository>
  <isAdmin>1</isAdmin>
  <isIsa>0</isIsa>
  <isRoled>0</isRoled>
  <changePassStamp>2018-10-24T06:31:31.000</changePassStamp>
  <autoRun />
  <temporaryAge>0</temporaryAge>
  <eternalPass>0</eternalPass>
  <certificate />
  </user>
  </data>
  </it>
<it>
  <k>532</k>
  <id>GUEST</id>
  <n>GUEST</n>
  <vis>1</vis>
  <type>User</type>
<sid>
  <sid>PS-1-532</sid>
  <type>User</type>
  </sid>
<data>
  <isNT>0</isNT>
  <isExternal>0</isExternal>
  <isBuiltin>0</isBuiltin>
<user>
  <mustChangePasswordAtNextLogon>0</mustChangePasswordAtNextLogon>
  <cannotChangePassword>0</cannotChangePassword>
  <lockedState>NotLocked</lockedState>
  <manageDBGrants>1</manageDBGrants>
  <maxLogonSessions>0</maxLogonSessions>
  <lastLoginStamp>1899-12-30T00:00:00.000</lastLoginStamp>
  <hasAccessToRepository>1</hasAccessToRepository>
  <isAdmin>0</isAdmin>
  <isIsa>0</isIsa>
  <isRoled>0</isRoled>
  <changePassStamp>2018-10-22T10:30:33.000</changePassStamp>
  <autoRun />
  <temporaryAge>0</temporaryAge>
  <eternalPass>0</eternalPass>
  <certificate />
  </user>
  </data>
  </it>
<it>
  <k>545</k>
  <id>NEWADMIN</id>
  <n>NewAdmin</n>
  <vis>1</vis>
  <type>User</type>
<sid>
  <sid>PS-1-545</sid>
  <type>User</type>
  </sid>
<data>
  <isNT>0</isNT>
  <isExternal>0</isExternal>
  <isBuiltin>0</isBuiltin>
<user>
  <mustChangePasswordAtNextLogon>0</mustChangePasswordAtNextLogon>
  <cannotChangePassword>0</cannotChangePassword>
  <lockedState>NotLocked</lockedState>
  <manageDBGrants>1</manageDBGrants>
  <maxLogonSessions>0</maxLogonSessions>
  <lastLoginStamp>1899-12-30T00:00:00.000</lastLoginStamp>
  <hasAccessToRepository>1</hasAccessToRepository>
  <isAdmin>0</isAdmin>
  <isIsa>0</isIsa>
  <isRoled>0</isRoled>
  <changePassStamp>2018-10-24T06:31:30.000</changePassStamp>
  <autoRun />
  <temporaryAge>0</temporaryAge>
  <eternalPass>0</eternalPass>
  <certificate />
  </user>
  </data>
  </it>
  </its>
  </users>
  <bisearchEnable>Disable</bisearchEnable>
  </meta>
  </metaGet>
  </SetMbSecResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetMbSec" :
{
"tMbSec" :
{
"id" : "S1!M"
},
"tArg" :
{
"pattern" :
{
"users" : "Change",
"user" :
{
"data" : "true",
"memberOf" : "Set"
}
},
"meta" :
{
"users" :
{
"its" :
{
"it" :
[
{
"k" : "18446744073709551615",
"id" : "NewAdmin",
"vis" : "true",
"type" : "User",
"sid" :
{
"sid" : ""
},
"data" :
{
"memberOf" :
{
"its" :
{
"it" :
[
{
"k" : "2147483649",
"id" : "ADMINISTRATORS",
"n" : "ADMINISTRATORS",
"vis" : "true",
"type" : "Group",
"sid" :
{
"sid" : "PS-2-1",
"type" : "Group"
},
"data" :
{
"desc" : "Built-in administrator group",
"isNT" : "false",
"isExternal" : "true",
"isBuiltin" : "true",
"group" :
{
"members" :
{
"its" :
{
"it" :
[
{
"k" : "2147483649",
"id" : "ADMIN",
"vis" : "true",
"type" : "User",
"sid" :
{
"sid" : "PS-1-1",
"type" : "User"
}
}
]
}
},
"hasAccessToken" : "false"
}
}
}
]
}
},
"user" :
{
"credentials" :
{
"pass" : "q1"
},
"oldCredentials" :
{
"pass" : "NewAdmin"
}
}
}
}
]
}
}
},
"metaGet" :
{
"pattern" :
{
"users" : "Get"
}
}
}
}
}

JSON response:

{
"SetMbSecResult" :
{
"id" :
{
"id" : "S1!M"
},
"metaGet" :
{
"id" :
{
"id" : "S1!M"
},
"meta" :
{
"users" :
{
"its" :
{
"it" :
[
{
"k" : "2147483649",
"id" : "ADMIN",
"vis" : "1",
"type" : "User",
"sid" :
{
"sid" : "PS-1-1",
"type" : "User"
},
"data" :
{
"desc" : " ",
"isNT" : "0",
"isExternal" : "0",
"isBuiltin" : "1",
"user" :
{
"mustChangePasswordAtNextLogon" : "0",
"cannotChangePassword" : "0",
"lockedState" : "NotLocked",
"manageDBGrants" : "1",
"maxLogonSessions" : "0",
"lastLoginStamp" : "2018-10-24T11:31:20.847",
"hasAccessToRepository" : "1",
"isAdmin" : "1",
"isIsa" : "0",
"isRoled" : "0",
"changePassStamp" : "2018-10-24T06:31:31.000",
"autoRun" : "",
"temporaryAge" : "0",
"eternalPass" : "0",
"certificate" : ""
}
}
},
{
"k" : "532",
"id" : "GUEST",
"n" : "GUEST",
"vis" : "1",
"type" : "User",
"sid" :
{
"sid" : "PS-1-532",
"type" : "User"
},
"data" :
{
"isNT" : "0",
"isExternal" : "0",
"isBuiltin" : "0",
"user" :
{
"mustChangePasswordAtNextLogon" : "0",
"cannotChangePassword" : "0",
"lockedState" : "NotLocked",
"manageDBGrants" : "1",
"maxLogonSessions" : "0",
"lastLoginStamp" : "1899-12-30T00:00:00.000",
"hasAccessToRepository" : "1",
"isAdmin" : "0",
"isIsa" : "0",
"isRoled" : "0",
"changePassStamp" : "2018-10-22T10:30:33.000",
"autoRun" : "",
"temporaryAge" : "0",
"eternalPass" : "0",
"certificate" : ""
}
}
},
{
"k" : "545",
"id" : "NEWADMIN",
"n" : "NewAdmin",
"vis" : "1",
"type" : "User",
"sid" :
{
"sid" : "PS-1-545",
"type" : "User"
},
"data" :
{
"isNT" : "0",
"isExternal" : "0",
"isBuiltin" : "0",
"user" :
{
"mustChangePasswordAtNextLogon" : "0",
"cannotChangePassword" : "0",
"lockedState" : "NotLocked",
"manageDBGrants" : "1",
"maxLogonSessions" : "0",
"lastLoginStamp" : "1899-12-30T00:00:00.000",
"hasAccessToRepository" : "1",
"isAdmin" : "0",
"isIsa" : "0",
"isRoled" : "0",
"changePassStamp" : "2018-10-24T06:31:30.000",
"autoRun" : "",
"temporaryAge" : "0",
"eternalPass" : "0",
"certificate" : ""
}
}
}
]
}
},
"bisearchEnable" : "Disable"
}
}
}
}
public static SetMbSecResult ChangeUser(string mb, string userName, string oldPassword, string newPassword, MbSubject group)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var setMbSec = new SetMbSec()
{
tArg = new SetMbSecArg()
{
//Operation execution pattern
pattern = new MbSecMdPattern()
{
users = ListOperation.Change,
user = new MbSubjectPattern()
{
data = true,
memberOf = ListOperation.Set
}
},
meta = new MbSecMd()
{
users = new MbSubjects()
{
its = new MbSubject[1]
{
new MbSubject()
{
k = ulong.MaxValue,
id = userName,
vis = true,
type = MbSubjectType.User,
sid = new SubjectSid() {sid = string.Empty},
data = new MbSubjectData()
{
user = new MbUserData()
{
//Old password
oldCredentials = new UserCreds() {pass = oldPassword},
//New password
credentials = new UserCreds() {pass = newPassword}
},
//The group, to which the user is included
memberOf = new MbSubjects()
{
its = new MbSubject[1]
{
group
}
}
}
}
}
}
},
//Parameters for updating users list after operation execution
metaGet = new GetMbSecArg()
{
pattern = new MbSecMdPattern()
{
users = ListOperation.Get
}
}
},
//Repository moniker
tMbSec = new MbId() { id = mb }
};
//Change user parameters
var result = somClient.SetMbSec(setMbSec);
return result;
}

See also:

SetMbSec: Operation