Will revoke Root privileges
@return void
960836
public function revokeRootPrivileges()
    {
        if ($this->revokeRootStatement == null) {
            $this->revokeRootStatement =
                $this->connection->prepare("DELETE FROM UserPrivileges WHERE username = ? AND rootPrivileges = 1");
            $u = $this->user->getUsername();
            $this->revokeRootStatement->bindParam(1, $u);
        }
        $this->revokeRootStatement->execute();
        $this->rootPrivilege = false;
    }
637175
public static function unregisterIncludeRoot($root)
  {
    $found_key=array_search($root, self::$frameworkRoots, true);
    if($found_key!==false){
      unset(self::$frameworkRoots[$found_key]);
      return true;
    }
    return false;
  }
279234
public function revokeExpiredPermissions()
    {
        $expiredPermissions = $this->permissions()->wherePivot('expires', '<', Carbon::now())->get();

        if ($expiredPermissions->count() > 0) {
            return $this->permissions()->detach($expiredPermissions->modelKeys());
        }
    }
963542
public function revoke_admin($admin_id)
    {
        if (!$this->is_loggedin) {
            return false;
        }

        $payload  = ['cmd' => 'revoke-admin', 'admin' => $admin_id];
        $response = $this->exec_curl('/api/s/' . $this->site . '/cmd/sitemgr', $payload);

        return $this->process_response_boolean($response);
    }
651283
public function logout()
    {
        if (!$this->hasSudoed()) {
            return false;
        }

        $this->auth->logout();

        $originalUserId = $this->session->get($this->sessionKey);

        if ($originalUserId) {
            $this->auth->loginUsingId($originalUserId);
        }

        $this->session->forget($this->sessionKey);
        $this->session->forget('sudosu.has_sudoed');

        return true;
    }
396954
public function revokePermission($permission)
    {
        return $this->mapArray($permission, function ($permission) {

            $permissionId = $this->parsePermissionId($permission);

            return $this->permissions()->detach($permissionId);
        });
    }
509405
private function removePermissions()
    {
        $this->pluginsService->removePluginPermissions($this->pluginsService->collectPermissions($this->translator->trans('plugin.ingest.permissions.label')));
    }
886728
public function down()
    {
        if (Schema::hasColumn('permissions', 'table_name')) {
            return false;
        }

        Schema::table('permissions', function (Blueprint $table) {
            $table->renameColumn('slug', 'table_name');
        });

        $dataTypes = DataType::all();
        $permissions = Permission::whereNotNull('table_name')->get();

        foreach ($permissions as $permission) {
            $dataType = $dataTypes->where('slug', $permission->table_name)->first();

            if ($dataType && $dataType->slug) {
                $permission->key = str_replace($dataType->slug, $dataType->name, $permission->key);
                $permission->table_name = $dataType->name;
                $permission->save();
            }
        }
    }
121023
public function suspend(): void
    {
        if (!userHasPermission('admin:auth:accounts:suspend')) {
            unauthorised();
        }

        // --------------------------------------------------------------------------

        //  Get the user's details
        $oUri       = Factory::service('Uri');
        $oInput     = Factory::service('Input');
        $oSession   = Factory::service('Session', 'nails/module-auth');
        $oUserModel = Factory::model('User', 'nails/module-auth');
        $iUserId    = $oUri->segment(5);
        $oUser      = $oUserModel->getById($iUserId);
        $bOldValue  = $oUser->is_suspended;

        // --------------------------------------------------------------------------

        //  Non-superusers editing superusers is not cool
        if (!isSuperuser() && userHasPermission('superuser', $oUser)) {
            $oSession->setFlashData('error', lang('accounts_edit_error_noteditable'));
            $this->returnToIndex();
        }

        // --------------------------------------------------------------------------

        //  Suspend user
        $oUserModel->suspend($iUserId);

        // --------------------------------------------------------------------------

        //  Get the user's details, again
        $oUser     = $oUserModel->getById($iUserId);
        $bNewValue = $oUser->is_suspended;

        // --------------------------------------------------------------------------

        //  Define messages
        if (!$oUser->is_suspended) {
            $oSession->setFlashData(
                'error',
                lang('accounts_suspend_error', title_case($oUser->first_name . ' ' . $oUser->last_name))
            );
        } else {
            $oSession->setFlashData(
                'success',
                lang('accounts_suspend_success', title_case($oUser->first_name . ' ' . $oUser->last_name))
            );
        }

        // --------------------------------------------------------------------------

        //  Update admin changelog
        $this->oChangeLogModel->add(
            'suspended',
            'a',
            'user',
            $iUserId,
            '#' . number_format($iUserId) . ' ' . $oUser->first_name . ' ' . $oUser->last_name,
            'admin/auth/accounts/edit/' . $iUserId,
            'is_suspended',
            $bOldValue,
            $bNewValue,
            false
        );

        // --------------------------------------------------------------------------

        $this->returnToIndex();
    }
414700
public function isRoot()
    {
        if(\Yii::$app->getUser()->getIsGuest()) return false;
        $user = \Yii::$app->getUser()->getIdentity();
        if($user->getId() == 1) return true;
        $auth = \Yii::$app->getAuthManager();
        $roles = $auth->getRolesByUser($user->getId());
        $roleNames = ArrayHelper::getColumn($roles,'name',false);
        return in_array('root', $roleNames);
    }
1162586
protected static function boot()
    {
        parent::boot();

        static::deleting(function ($model) {
            $model->administrators()->detach();

            $model->permissions()->detach();
        });
    }
1093423
public function revoke()
    {
        if (!isset($this->_links->self->href)) {
            return $this;
        }

        $body = null;
        if($this->client->usesOAuth()) {
            $body = json_encode([
                "testmode" => $this->mode === "test" ? true : false
            ]);
        }

        $result = $this->client->performHttpCallToFullUrl(
            MollieApiClient::HTTP_DELETE,
            $this->_links->self->href,
            $body
        );

        return $result;
    }
598264
def revoke_tokens(self):
        

        self.is_active = False
        self.save()

        self.refresh_token.revoke_tokens()
665405
public function purgeCurrent()
    {
        if (!$this->valid()) {
            return;
        }

        if ($this->current()->hasUid()) {
            $uid = $this->current()->getUid();
            if (isset($this->uids[$uid])) {
                unset($this->uids[$uid]);
            }
        }

        $this->detach($this->current());

        $this->markAsDirty();
    }
107350
public function deleteAll() {
        if(!$this->is_setup) return;
        Database::prepare(
            'DELETE FROM `##maj_sosa`'.
            ' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id ')
            ->execute(array(
                'tree_id' => $this->tree->getTreeId(), 
                'user_id' => $this->user->getUserId()                
            ));
    }
1027524
public function revokeSitePrivileges()
    {
        if ($this->revokeSiteStatement == null) {
            $this->revokeSiteStatement =
                $this->connection->prepare("DELETE FROM UserPrivileges WHERE username = ? AND sitePrivileges = 1");
            $u = $this->user->getUsername();
            $this->revokeSiteStatement->bindParam(1, $u);
        }
        $this->revokeSiteStatement->execute();
        $this->sitePrivilege = 0;
    }
1250783
private static void revokePermissions(Context ctx, Uri uri){
        ctx.revokeUriPermission(uri,
                Intent.FLAG_GRANT_WRITE_URI_PERMISSION |
                        Intent.FLAG_GRANT_READ_URI_PERMISSION);
    }