Do you have the session cookie available in the sub domain ? (you can var_dump the $_COOKIE[oc_name] to see what it contains. where oc_name is the name of your owncloud instance.) if so, you can have the session id. Once you got the session id you can know if the user is authenticated.
MC Le Vendredi 24 Juin 2016 14:00 CEST, [email protected] a écrit: Send Devel mailing list submissions to [email protected] To subscribe or unsubscribe via the World Wide Web, visit http://mailman.owncloud.org/mailman/listinfo/devel or, via email, send a message with subject or body 'help' to [email protected] You can reach the person managing the list at [email protected] When replying, please edit your Subject line so it is more specific than "Re: Contents of Devel digest..." Today's Topics: 1. Re: Get current user from outside (George W Langham) ---------------------------------------------------------------------- Message: 1 Date: Thu, 23 Jun 2016 16:21:29 +0100 From: George W Langham <[email protected]> To: List for Developers of ownCloud <[email protected]> Subject: Re: [owncloud-devel] Get current user from outside Message-ID: <CANuKeRHet-t=BhDxbJ_ZhQd_NcZOn2u4yHiJfUyfF23=yfx...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" yes. On Wed, May 25, 2016 at 7:43 AM, <[email protected]> wrote: > Hi all! > > I'm wondering if / how I can get the logged in user from another subdomain? > > - oC is running on 'sub.myDomain.tld' > - My script is running on 'another.sub.myDomain.tld' > > I tried > > chdir('../path/to/oC/'); // it didn't work to require_once() the > following files directly due to an autoloader exception so I just changed > the current dir > require_once 'lib/base.php'; > require_once 'lib/public/user.php'; > > if( \OCP\User::isLoggedIn()) > { > $user->username = \OC::$server->getUserSession(); > } > else > { > $user->username = 'NO_USER'; > } > > $user->username = \OC::$server->getUserSession()->getUser()->getUID() ; > > var_dump($user->username); // string(7) "NO_USER" > > I also added the used subdomain as trusted domain in /config/config.php. > I guess I can't just include /lib/base.php, can I? It works if I try this > with a file within my oC directory. > > > > Many thanks in advance! > > Stefan > > _______________________________________________ > Devel mailing list > [email protected] > http://mailman.owncloud.org/mailman/listinfo/devel > > -- Regards, George William Langham -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mailman.owncloud.org/pipermail/devel/attachments/20160623/3815b797/attachment-0001.html> ------------------------------ _______________________________________________ Devel mailing list [email protected] http://mailman.owncloud.org/mailman/listinfo/devel End of Devel Digest, Vol 30, Issue 13 *************************************
_______________________________________________ Devel mailing list [email protected] http://mailman.owncloud.org/mailman/listinfo/devel
