Первый вопрос. Можно массово. В контейнере groups перечислите группы, для которых нужно закрыть доступ на menuItem. Предполагается что кнопка это menuItem. Вот Job:
X++:
static void setRights(Args _args)
{
SecurityKeySet secSet;
UserGroupInfo userGroup;
DomainInfo domain;
AccessType currentAccessType;
MenuItemName name = menuItemDisplayStr(InventTable);
AccessRecordType type = AccessRecordType::MenuItemDisplay;
container groups = ['group1, group2', 'group3'];
;
while select userGroup
where userGroup.Id != 'Admin'
{
if (confind(groups, userGroup.Id) != 0)
{
while select domain
{
secSet = SysSecurity::constructSecurityKeySet();
secSet.loadGroupRights(userGroup.id, domain.Id);
currentAccessType = secSet.menuItemAccess(name, type);
if (currentAccessType != AccessType::NoAccess)
{
secSet.menuItemAccess(name, type, currentAccessType);
xAccessRightsList::saveSecurityRights(secSet.pack(), userGroup.Id, domain.Id);
}
}
}
}
}
Второй вопрос не понял.