feat: Added LDAP support to the Groups API

This commit is contained in:
Justin 2019-05-25 18:12:24 -04:00 committed by Justin Dalrymple
parent ee6d490799
commit 3f6d4095cd

View File

@ -9,10 +9,15 @@ class Groups extends BaseService {
return RequestHelper.post(this, 'groups', options);
}
remove(groupId: GroupId) {
createLDAPLink(groupId: GroupId, cn, groupAccess, provider: string, options?: Sudo) {
const gId = encodeURIComponent(groupId);
return RequestHelper.delete(this, `groups/${gId}`);
return RequestHelper.post(this, `groups/${gId}/ldap_group_links`, {
cn,
groupAccess,
provider,
...options,
});
}
edit(groupId: GroupId, options?: BaseRequestOptions) {
@ -27,6 +32,17 @@ class Groups extends BaseService {
return RequestHelper.del(this, `groups/${gId}`, options);
}
removeLDAPLink(
groupId: GroupId,
cn,
{ provider, ...options }: Sudo & { provider?: string } = {},
) {
const gId = encodeURIComponent(groupId);
const url = provider ? `${provider}/${cn}` : `${cn}`;
return RequestHelper.del(this, `groups/${gId}/ldap_group_links/${url}`, options);
}
search(nameOrPath: string, options?: Sudo) {
return RequestHelper.get(this, 'groups', {
@ -46,6 +62,12 @@ class Groups extends BaseService {
return RequestHelper.get(this, `groups/${gId}/subgroups`, options);
}
syncLDAP(groupId: GroupId, options?: Sudo) {
const gId = encodeURIComponent(groupId);
return RequestHelper.post(this, `groups/${gId}/ldap_sync`, options);
}
}
export default Groups;