adminCheck
talawa-api • Docs
talawa-api / utilities/userFamilyAdminCheck / adminCheck
Function: adminCheck()
> adminCheck(userId
, userFamily
): Promise
<void
>
Checks if the current user is an admin of the organization or a super admin. Throws an UnauthorizedError if the user is neither an admin nor a super admin.
Parameters
• userId: string
| ObjectId
The ID of the current user.
• userFamily: InterfaceUserFamily
The user family data of type InterfaceUserFamily
.
Returns
Promise
<void
>
Remarks
This function queries the userFamily
to check if the userId
is listed as an admin.
Additionally, it queries the AppUserProfile
to check if the userId
is a super admin.