Ниже приведён пример использования операции SetMbSec для изменения профиля пользователя. В запросе передаётся пользователь и новые параметры его профиля. В ответе приходит обновленный список профилей пользователей репозитория.
{
"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" : "АДМИНИСТРАТОРЫ",
"n" : "АДМИНИСТРАТОРЫ",
"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" : "Рабочий",
"email" : "NewWork@example.ru"
},
"personal" :
{
"name" : "Персональный",
"email" : "NewHome@example.ru"
},
"mobile" :
{
"name" : "Мобильный",
"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" : "Рабочий",
"email" : "NewWork@example.ru"
},
{
"name" : "Мобильный",
"email" : "NewMobile@example.ru"
},
{
"name" : "Персональный",
"email" : "NewHome@example.ru"
}
]
},
"def" :
{
"name" : "Рабочий",
"email" : "NewWork@example.ru"
},
"work" :
{
"name" : "Рабочий",
"email" : "NewWork@example.ru"
},
"personal" :
{
"name" : "Персональный",
"email" : "NewHome@example.ru"
},
"mobile" :
{
"name" : "Мобильный",
"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" : "Рабочий",
"email" : ""
},
{
"name" : "Мобильный",
"email" : ""
},
{
"name" : "Персональный",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
},
{
"k" : "0",
"id" : "PS-1-537",
"n" : "NEWADMIN",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-537"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Рабочий",
"email" : ""
},
{
"name" : "Мобильный",
"email" : ""
},
{
"name" : "Персональный",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
},
{
"k" : "0",
"id" : "PS-1-539",
"n" : "NEWADMIN",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-539"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Рабочий",
"email" : ""
},
{
"name" : "Мобильный",
"email" : ""
},
{
"name" : "Персональный",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
},
{
"k" : "0",
"id" : "PS-1-541",
"n" : "NEWADMIN",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-541"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Рабочий",
"email" : ""
},
{
"name" : "Мобильный",
"email" : ""
},
{
"name" : "Персональный",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
},
{
"k" : "0",
"id" : "PS-1-543",
"n" : "NEWADMIN",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-543"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Рабочий",
"email" : ""
},
{
"name" : "Мобильный",
"email" : ""
},
{
"name" : "Персональный",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
},
{
"k" : "0",
"id" : "PS-1-545",
"n" : "NEWADMIN",
"vis" : "1",
"sid" :
{
"sid" : "PS-1-545"
},
"emails" :
{
"its" :
{
"it" :
[
{
"name" : "Рабочий",
"email" : ""
},
{
"name" : "Мобильный",
"email" : ""
},
{
"name" : "Персональный",
"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" : "Рабочий",
"email" : ""
},
{
"name" : "Мобильный",
"email" : ""
},
{
"name" : "Персональный",
"email" : ""
}
]
}
},
"props" :
{
"its" : ""
}
}
]
}
},
"bisearchEnable" : "Disable"
}
}
}
}
public static SetMbSecResult ChangeUserProfile(string mb, MbSubject user)
{
var somClient = new SomPortTypeClient(); //Прокси-объект для выполнения операций
//Изменение профиля для указанного пользователя
user.profile = new MbSecProfile()
{
sid = user.sid,
emails = new MbSecProfileEmails()
{
its = new MbSecProfileEmail[3],
mobile = new MbSecProfileEmail() { name = "Мобильный", email = "NewMobile@example.ru" },
personal = new MbSecProfileEmail() { name = "Персональный", email = "NewHome@example.ru" },
work = new MbSecProfileEmail() { name = "Рабочий", email = "NewWork@example.ru" }
},
props = new MbSecProfileProps()
{
its = new MbSecProfileProp[1]
{
new MbSecProfileProp() { id = "Location", value = "Home"}
}
}
};
//Параметры выполнения операции
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 }
};
//Изменение профиля пользователя
var result = somClient.SetMbSec(setMbSec);
return result;
}
См. также: