if (OC_User::isAdminUser(OC_User::getUser())) { // Current user is an admin } else { // Current user is not an admin }
$userId = 'john.doe'; if (OC_User::isAdminUser($userId)) { // User is an admin } else { // User is not an admin }In this example, the isAdminUser method is used to check if the user with the username 'john.doe' has admin privileges. The package library for OC_User is part of the ownCloud core package.