热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Errorwhentryingtodeleteauser

v.1.2.beta4Igetthefollowingerrorwhentryingtodeleteauserfromtheadmin

v.1.2.beta4

I get the following error when trying to delete a user from the admin panel:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Exception

Exception – yii\base\Exception



Tried to delete a user which is owner of a space!

1. in /var/www/bsmug.nl/httpdocs/protected/humhub/modules/user/models/User.php at line 312

303304305306307308309310311312313314315316317318319320321     * Before Delete of a User

     *

     */

    public function beforeDelete()

    {



        // We don't allow deletion of users who owns a space - validate that

        foreach (\humhub\modules\space\models\Membership::GetUserSpaces($this->id) as $space) {

            if ($space->isSpaceOwner($this->id)) {

                throw new Exception("Tried to delete a user which is owner of a space!");

            }

        }



        // Disable all enabled modules

        foreach ($this->getAvailableModules() as $moduleId => $module) {

            if ($this->isModuleEnabled($moduleId)) {

                $this->disableModule($moduleId);

            }

        }

2. in /var/www/bsmug.nl/httpdocs/protected/vendor/yiisoft/yii2/db/ActiveRecord.php at line 642 – humhub\modules\user\models\User::beforeDelete()

3. in /var/www/bsmug.nl/httpdocs/protected/vendor/yiisoft/yii2/db/ActiveRecord.php at line 613 – yii\db\ActiveRecord::deleteInternal()

4. in /var/www/bsmug.nl/httpdocs/protected/humhub/modules/admin/controllers/UserController.php at line 234 – yii\db\ActiveRecord::delete()

228229230231232233234235236237238239240            foreach (\humhub\modules\space\models\Membership::GetUserSpaces($user->id) as $space) {

                if ($space->isSpaceOwner($user->id)) {

                    $space->addMember(Yii::$app->user->id);

                    $space->setSpaceOwner(Yii::$app->user->id);

                }

            }

            $user->delete();

            return $this->redirect(['/admin/user']);

        }



        return $this->render('delete', ['model' => $user]);

    }



5. humhub\modules\admin\controllers\UserController::actionDelete()

6. in /var/www/bsmug.nl/httpdocs/protected/vendor/yiisoft/yii2/base/InlineAction.php at line 57 – call_user_func_array([humhub\modules\admin\controllers\UserController, 'actionDelete'], [])

7. in /var/www/bsmug.nl/httpdocs/protected/vendor/yiisoft/yii2/base/Controller.php at line 156 – yii\base\InlineAction::runWithParams(['query' => 'admin/user/delete', 'id' => '8', 'doit' => '2'])

8. in /var/www/bsmug.nl/httpdocs/protected/vendor/yiisoft/yii2/base/Module.php at line 523 – yii\base\Controller::runAction('delete', ['query' => 'admin/user/delete', 'id' => '8', 'doit' => '2'])

9. in /var/www/bsmug.nl/httpdocs/protected/vendor/yiisoft/yii2/web/Application.php at line 102 – yii\base\Module::runAction('admin/user/delete', ['query' => 'admin/user/delete', 'id' => '8', 'doit' => '2'])

10. in /var/www/bsmug.nl/httpdocs/protected/vendor/yiisoft/yii2/base/Application.php at line 380 – yii\web\Application::handleRequest(humhub\components\Request)

11. in /var/www/bsmug.nl/httpdocs/index.php at line 24 – yii\base\Application::run()

1819202122232425    (is_readable(__DIR__ . '/protected/config/dynamic.php')) ? require(__DIR__ . '/protected/config/dynamic.php') : [],

    require(__DIR__ . '/protected/config/common.php'),

    require(__DIR__ . '/protected/config/web.php')

);





(new humhub\components\Application($config))->run();



 $_GET = [

    'query' => 'admin/user/delete',

    'id' => '8',

    'doit' => '2',

];



$_POST = [

    '_csrf' => 'SUpTMVBqOC4aBj5hOCRCXiYwPgEFDX9NDisgdGcpZ2ETJAR7BTh5fw==',

];



$_COOKIE = [

    '__cfduid' => 'd16fe61cdfc0ea1ddd72db42f2ba71b851490363684',

    'language' => '9c2c48f8ccececa78db90effe08f2de5f1b2e176942b361619e086c13369d2c0a:2:{i:0;s:8:"language";i:1;s:2:"nl";}',

    '_csrf' => 'fde4447a57749613d8e75a649e7f39279a995fb8d52e14827e407626b541ca22a:2:{i:0;s:5:"_csrf";i:1;s:32:"SLmPhNzpozm0UgGcGasE7C_OZnWJURAQ";}',

    'pm_getting-started-panel' => 'expanded',

    '_pk_id_1_d648' => 'e977df43d5ecc831.1490399497.3.1490869356.1490869339.',

    '_pk_ses_1_d648' => '*',

    'PHPSESSID' => 'eedvvg3id3v1kim3aokhg57nj4',

    '_identity' => 'aeb25abe8d7922762eea59e84dec9766b3e2f29a376088bbe309faea1c5b704aa:2:{i:0;s:9:"_identity";i:1;s:50:"[1,"6b68b7d4-bd70-4b68-80c3-c8bbcd42feb4",2592000]";}',

    '_pk_id_2_d648' => 'a35558cd041404c2.1490652062.3.1490870088.1490869695.',

    '_pk_ses_2_d648' => '*',

];



$_SESSION = [

    '__flash' => [],

    '__id' => 1,

    '__expire' => 1500870090,

    'live.poll.lastQueryTime' => 1490870086,

    'user.canSeeAdminSection' => true,

];

Yii Framework

2017-03-30, 12:34:51



nginx/1.6.2

Yii Framework/2.0.11.2

‹ › ×

该提问来源于开源项目:humhub/humhub

The admin user controller should automatically switch the owner https://github.com/humhub/humhub/blob/master/protected/humhub/modules/admin/controllers/UserController.php#L228





   



推荐阅读
author-avatar
莺妈
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有