Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home directory is not created when using \OC_User::loginWithApache() #19656

Closed
butonic opened this issue Oct 8, 2015 · 6 comments
Closed

home directory is not created when using \OC_User::loginWithApache() #19656

butonic opened this issue Oct 8, 2015 · 6 comments

Comments

@butonic
Copy link
Member

butonic commented Oct 8, 2015

When doing a form login the home dir is created on the fly in https://github.com/owncloud/core/blob/master/lib/private/user.php#L252

When using an apache auth mechanism the home dir is not created on the fly, resulting in:

{
   "level" : 4,
   "time" : "2015-10-05T20:32:59+00:00",
   "app" : "index",
   "remoteAddr" : "128.205.218.181",
   "reqId" : "l7gXm+K7RFJt0vismdZ6",
   "message" : "Exception: {\"Exception\":\"OCP\\\\Files\\\\NotFoundException\",\"Message\":\"\",\"Code\":0,\"Trace\":"see below",\"Line\":971}"
}
#0 /var/www/owncloud/apps/files/index.php(84): OC_Helper::getStorageInfo('/', false)
#1 /var/www/owncloud/lib/private/route/route.php(154) : runtime-created function(1): require_once('/var/www/ownclo...')
#2 [internal function]: __lambda_func(Array)
#3 /var/www/owncloud/lib/private/route/router.php(274): call_user_func('?lambda_763', Array)
#4 var/www/owncloud/lib/base.php(874): OC\Route\Router->match('/apps/files/')
#5 /var/www/owncloud/index.php(40): OC::handleRequest()
#6 {main}

It should be possible to use the post_login hook as the only codepath for homedir / filesystem setup:
The hook in https://github.com/owncloud/core/blob/master/lib/private/user.php#L291 should be fired in https://github.com/owncloud/core/blob/master/lib/private/user.php#L252 as well.

@icewind1991 or am I wrong?

@awrede
Copy link

awrede commented Oct 30, 2015

I just ran into the same issue with OC_User_IMAP. Is there a work-around, other than creating a local account?

@butonic
Copy link
Member Author

butonic commented Oct 30, 2015

use an onLogin hook:

\OCP\Util::connectHook('OC_User', 'post_login', 'OCA\CookieSSO\User\Backend\CookieSSO', 'onLogin');

to register a hook that calls \OC::$server->getUserFolder($params['uid']); to initialize the home directory for that user.

    /**
     * called by hook listener added in app.php
     * will create the user home
     * @param string[] $params
     */
    public static function onLogin(array $params) {
        \OC::$server->getUserFolder($params['uid']);
    }

hope this helps.

@MorrisJobke
Copy link
Contributor

cc @PVince81 please triage and assign the correct milestone

@PVince81 PVince81 added this to the 9.0-current milestone Dec 8, 2015
@PVince81
Copy link
Contributor

PVince81 commented Dec 8, 2015

Set to 9.0 to look into a generic solution that doesn't require a workaround.

CC @cmonteroluque

@ghost ghost modified the milestones: 9.1-next, 9.0-current Feb 22, 2016
@MorrisJobke
Copy link
Contributor

Fixed via #23903 (comment)

@lock
Copy link

lock bot commented Aug 5, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants