Numtel-MySQL/React/Admin Only Publications


First would certainly like to thank @numtel for the excellent work on the reactive MySQL package.

I am trying to limit data published to the clients from the server side based on information stored in the MySQL database and as a newbie, I seem to be stuck at the starting line and am afraid of my attempts as far as security is concerned.

The app is designed to do time tracking and I only want admin users to be able to look at the timers/timeslips of other users. Right now my publish code is as follows (backticks are missing due to the forum’s functionality):

Meteor.publish(‘Tickets’, function () {
SELECT tickets.*, users.Name as username, as clientname FROM tickets left join users on tickets.userid = users.userid left join clients on tickets.clientId = clients.clientid where Status < 4 and users.userId > 0 ORDER BY ASC, tickets.TicketID DESC,
[{ table: ‘tickets’ }]);

How would I go about passing in a Meteor.userId() into the publication, or am I way off track as to how to accomplish this feature?


And I figured out that I needed to use this.userId inside of the publication.