Currently, I am focusing on constructing the Microsoft Teams tab using Angular. In the code snippet below, I am retrieving context from Microsoft and invoking various functions. One of these functions is this.checkOwner()
, which determines whether the logged-in user is the owner or not.
The challenge I am encountering is that when logged in as a member (non-owner), there are instances where it incorrectly returns true
. This issue seems to only occur when using the mobile app as opposed to the desktop app. Could this discrepancy be due to delays caused by Ngzone?
microsoftTeams.getContext((context: microsoftTeams.Context) => this.zone.run(() => {
this.authSrvc.updateCurrentContext(context);
this.checkOwner();
.
.
.
))}
checkOwner() {
this.authSrvc.getOwnersList(this.authSrvc.currentContext.groupId).subscribe((res: any) => {
const doesExist = res.value.find(entry => entry.userPrincipalName === this.authSrvc.currentContext.userPrincipalName);
this.isOwner = doesExist ? true : false;
});
}