Can't get logged user in 'protected' function
See original GitHub issueHi,
I’m trying to add some security when downloading files but I can’t get the user info inside the ‘protected’ function. My configuration looks like this:
Documents = new Meteor.Files({
storagePath: "D:/temp",
collectionName: 'documents',
downloadRoute: '/doc',
allowClientCode: true,
chunkSize: 256*128,
protected: (fileObj) => {
console.log(fileObj);
return true;
}
});
The file is downloaded and I can get the info of the fileObj but I tried this.userId (undefined), this.user() -gives an TypeError… has no method ‘user’.
What am I doing wrong?
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
overridden authenticated method in Login Controller doesn't ...
That's because you are overwriting the login function, hence the authenticated function is never called. If you take a look at the trait:...
Read more >I can't get the auth user. - Laracasts
use Illuminate\Auth\Guard; class MyController extends Controller { protected $currentUser; public function __construct(Guard $auth) { $this->currentUser ...
Read more >Authentication - Laravel - The PHP Framework For Web Artisans
While handling an incoming request, you may access the authenticated user via the Auth facade's user method: use Illuminate\Support\Facades\Auth;. // Retrieve ...
Read more >Auth::user() not working inside apply function in global scope ...
I was trying to create global scope dependent on a role of logged in user (typically, user with some acces rights based on...
Read more >Manage Users in Firebase - Google
You create a new user in your Firebase project by calling the createUserWithEmailAndPassword method or by signing in a user for the first...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @thomasspiesser, the following code is working for me now:
Regards
Hello,
I finally solve the problem with the combination of
protected
anddownloadCallback
. This is the code:Thanks