[owncloud-devel] Get current user from outside (George W Langham)

Stefan Herzog sign_in at die-herzogs.com
Fri Jul 1 06:12:39 GMT 2016


Where could I get the name of my oC instance?


Mit freundlichen Grüßen / Yours sincerely 

Stefan Herzog

> Am 24.06.2016 um 15:42 schrieb Mamadou Cissé <mamadou.cisse at recia.fr>:
> 
> 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, devel-request at owncloud.org a écrit:
>  
>> 
>> Send Devel mailing list submissions to
>> devel at owncloud.org
>> 
>> 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
>> devel-request at owncloud.org
>> 
>> You can reach the person managing the list at
>> devel-owner at owncloud.org
>> 
>> 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 <georgelangham1990 at gmail.com>
>> To: List for Developers of ownCloud <devel at owncloud.org>
>> Subject: Re: [owncloud-devel] Get current user from outside
>> Message-ID:
>> <CANuKeRHet-t=BhDxbJ_ZhQd_NcZOn2u4yHiJfUyfF23=yFX+cQ at mail.gmail.com>
>> Content-Type: text/plain; charset="utf-8"
>> 
>> yes.
>> 
>> On Wed, May 25, 2016 at 7:43 AM, <sign_in at die-herzogs.com> 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
>> > Devel at owncloud.org
>> > 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
>> Devel at owncloud.org
>> http://mailman.owncloud.org/mailman/listinfo/devel
>> 
>> 
>> End of Devel Digest, Vol 30, Issue 13
>> *************************************
> 
> 
> 
>  
> _______________________________________________
> Devel mailing list
> Devel at owncloud.org
> http://mailman.owncloud.org/mailman/listinfo/devel



More information about the Devel mailing list