Closed tokewf closed 1 year ago
You can use the GroupsApi from the newest APIs.
@Component({...})
export class FooComponent implements OnInit {
constructor(private apiService: AlfrescoApiService) { }
ngOnInit() {
const groupsApi = new GroupsApi(this.apiService.getInstance());
groupsApi.listGroupMembershipsForPerson('-me-').then(res => console.log(res))
}
}
Type of issue: (check with "[x]")
Current behavior: Using the groups API via the
AlfrescoApiService
from@alfresco/adf-core
in an Angular app like so:throws an error that property
listGroupMembershipsForPerson
does not exist on typeGroupsApi
, even though the documentation states that the endpoint is available in Alfresco 5.2.1 and up (https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/GroupsApi.md#listGroupMembershipsForPerson). I an running Alfresco 6.x, ADF 3.3.0.Digging through the code, it seems that
AlfrescoApiService.groupsApi
(and the other properties of the service) usesAlfrescoApiCompatibility
from@alfresco/js-api
. The legacyGroupsApi
of this compatibility API is implemented insrc/api-legacy/content-rest-api/src/api/groupsApi.ts
. This maps most—but not all—methods of the newGroupsApi
insrc/api/content-rest-api/api/groups.api.ts
(Indeed, the new groups API is even made privately available to the legacy groups API asNewGroupsApi
)Crucially for my use case, the methods
listGroupMemberships
,listGroupMembershipsForPerson
andlistGroups
are not available in the legacy groups API, which is the one I have access to viathis.apiService.groupsApi
as in the example above. While I could (rather confusingly) dothis.apiService.groupsApi.groupsApi.listGroupMembershipsForPerson('-me-')
—since the membergroupsApi
ofgroupsApi
is theNewGroupsApi
:confounded:—this new groups API is a private member, so I can't use it.How do I get access to these API methods in my app?