nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.44k stars 4.08k forks source link

Authenticating with ZimbraDrive results "Call to a member function inGroup() on null" #21497

Closed klebed closed 4 years ago

klebed commented 4 years ago

Hi, everyone! Got an issue with following versions: Nextcloud 18.0.6 ZimbraDrive 0.8.25

When trying to authenticate with zimbra credentials i'm getting error "Call to a member function inGroup() on null". It seems like error produced by insertUserInGroup function in nextcloud/apps/zimbradrive/lib/auth/abstractzimbrausersbackend.php It produces error even when I turned off option 'Set Zimbra group to users' in app config. Quick fix: comment out part of the function like that:

    protected function insertUserInGroup(User $user, $groupName)
    {
        if(isset($user))
        {
            if(!$this->groupManager->groupExists($groupName))
            {
                $this->groupManager->createGroup($groupName);
            }
/**
            $targetGroup = $this->groupManager->get($groupName);
            if(!$targetGroup->inGroup($user))
            {
                $targetGroup->addUser($user);
            }
            **/
        }
    }

I guess here it tries to add user to a group called zimbra... group is here, users are actually in it, but still getting error. Might be some internal APIs was changed and other way should be used to obtain targetGroup. I'm not quite familiar with Nextcloud architecture, and I need some advise where to dig to find particular cause of the issue.

kesselb commented 4 years ago

Thank you for taking the time to report a problem :+1: Please report this problem to the zimbadrive app.

klebed commented 4 years ago

Thank you for taking the time to report a problem +1 Please report this problem to the zimbadrive app.

sure, but they don't have 'issues' on project's github. At least here I leave footprint of a problem so other Nextcloud users could find it and quickly make a temporary fix. :)

nodify-at commented 4 years ago

I get the same error and a quick fix is to set an e-mail manually to the user. I think somehow zimbra drive can not resolve the email and set it correctly. I don't know how to fix it on this controller, I will try something to analyse and resolve it. If someone else can help us to solve it, would be great :)

afavata commented 4 years ago

@klebed You are a star... You have resolved the issue I had with Zimbra/Nextcloud connection. Many Many thanks. Alex

EdG91 commented 4 years ago

Hello, I am facing the same issue after upgrade from NC 17 to 18... What do you mean by "a quick fix is to set an e-mail manually to the user" ? Do I have to connect as admin in NC, and then resend the welcome email ? Ed

klebed commented 4 years ago

Hello, I am facing the same issue after upgrade from NC 17 to 18... What do you mean by "a quick fix is to set an e-mail manually to the user" ? Do I have to connect as admin in NC, and then resend the welcome email ? Ed

Hi! Just do it my way. It's a bit inconvenient, but, at least it works.