javascript - Prevent users from seeing Meteor client script by role -


in meteor put sensitive code in /server , browser code in /client. meteor automatically compiles , minifies /client side code us. meteor.

however, i'm using https://github.com/alanning/meteor-roles manage content user roles. 1 of roles administrator , have client side scripts use user eg: /client/admin-only/**.js. code in scripts checks user administrator , calls server sensitive tasks, don't want adminstrator able see code.

what want ensure these client admin js files downloaded users actual administrators , not included in auto-compiled/minified js created meteor.

is there way setup meteor generate 2 versions of it's client js - 1 normal users , 1 administrators - , download files based on user role?

the meteor guide addresses issue:

while client-side code of application accessible browser, every application have secret code on server don’t want share world. secret business logic in app should located in code loaded on server. means in server/ directory of app, in package included on server, or in file inside package loaded on server.

basically, mdg's guidance dumb down admin view as possible. if that's not acceptable, you'll need have bundled in separate meteor application on either internally accessible network only, or using two mongodb instances can separate authentication out second app.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -