AD: участники групп с доступом в bj

У каждой группы домена в «Пользователи и вход» — «участники: N»: ФИО,
логин, почта, отметки «отключён в AD» и «входил в bj»; с вложенными
группами (LDAP_MATCHING_RULE_IN_CHAIN). GET
/admin/setup/users/ad-group-members — только для групп из настроек bj.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q7eREaYwUt1i4fNLZcGnjn
This commit is contained in:
fontvielle
2026-10-22 13:37:51 +03:00
parent 76e6f82369
commit fbcc859289
2 changed files with 95 additions and 2 deletions
@@ -54,9 +54,24 @@
<button type="submit" class="btn btn-ok">Дать доступ группе</button>
</form>
{{if $A.ADGroups}}<div class="ad-groups"><div class="muted" style="font-size:13px;margin-bottom:6px">Группы домена с доступом в bj — их сотрудники входят без отдельной учётной записи:</div>
{{range $A.ADGroups}}<div class="ad-grp"><span><b>{{.Name}}</b> → {{roleTitle .Role}}</span>
{{range $A.ADGroups}}<div class="ad-grp"><span><b>{{.Name}}</b> → {{roleTitle .Role}} <details class="ad-mem" data-dn="{{.Group}}" style="display:inline-block;margin-left:8px;vertical-align:top"><summary style="cursor:pointer;font-size:12.5px;color:var(--accent)">участники: …</summary><div class="ad-mem-list" style="font-size:12.5px;margin:6px 0 2px;max-height:260px;overflow:auto"></div></details></span>
<form method="post" action="/admin/setup/users/ad-group"><input type="hidden" name="return_to" value="{{$.Ret}}"><input type="hidden" name="section" value="acc-ad"><input type="hidden" name="group" value="{{.Name}}"><input type="hidden" name="remove" value="1"><button type="submit" class="dq-link">убрать</button></form></div>{{end}}
</div>{{end}}
</div>
<script>(function(){ // участники групп — кто получает доступ в bj через группу (с вложенными группами)
function esc(s){return String(s==null?'':s).replace(/[&<>"]/g,function(c){return{'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[c]})}
document.querySelectorAll('details.ad-mem').forEach(function(d){
var sum=d.querySelector('summary'), box=d.querySelector('.ad-mem-list');
fetch('/admin/setup/users/ad-group-members?dn='+encodeURIComponent(d.getAttribute('data-dn')),{cache:'no-store'}).then(function(r){return r.json()}).then(function(x){
if(!x.ok){ sum.textContent='участники: не получены'; box.innerHTML='<span style="color:var(--err)">'+esc(x.error)+'</span>'; return; }
var m=x.members||[], off=m.filter(function(u){return u.disabled}).length;
sum.textContent='участники: '+(m.length-off)+(off?' (+'+off+' отключены)':'');
box.innerHTML=m.length?m.map(function(u){
return '<div'+(u.disabled?' style="opacity:.55"':'')+'>'+esc(u.name||u.login)+' <span class="muted">'+esc(u.login)+(u.email?' · '+esc(u.email):'')+'</span>'+
(u.disabled?' <span class="muted">— отключён в AD</span>':'')+(u.in_bj?' <span class="muted">· входил в bj</span>':'')+'</div>';
}).join(''):'<span class="muted">в группе никого нет</span>';
}).catch(function(){ sum.textContent='участники: нет связи'; });
});
})();</script>{{end}}
<script>(function(){
var q=document.getElementById('acc-ad-q'), st=document.getElementById('acc-ad-st'), ul=document.getElementById('acc-ad-res'), f=document.getElementById('acc-ad-form'), gf=document.getElementById('acc-ad-gform'), who=document.getElementById('acc-ad-who'), gwho=document.getElementById('acc-ad-gwho'), t=0;
function esc(s){return String(s==null?'':s).replace(/[&<>"]/g,function(c){return{'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[c]})}