Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion A simple little server side data protection trick...aka...Slice tastes great!
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
steeve  
View profile  
 More options Aug 23 2012, 5:53 pm
From: steeve <stephentcan...@gmail.com>
Date: Thu, 23 Aug 2012 14:53:48 -0700 (PDT)
Local: Thurs, Aug 23 2012 5:53 pm
Subject: A simple little server side data protection trick...aka...Slice tastes great!

Personally, I am a big fan of the drink Slice.  Orange clearly being my
favorite.

So, I am sure everyone is using/sharing Models client/server side and doing
all kinds of fancy pantsy validation stuff to protect data inserts and
updates and whatnots.

Just wanted to share what I do on top of client/server Models and data
validation routines.  I always call my Model.validate() methods inside the
inserts/updates before I do this stuff anyway and throw Meteor errors so it
bubbles all the way back up to the client view.

You can do this with either the old way of protecting data by locking down
and using Meteor methods or with the auth branch.  I use the auth branch.

I slice everything before I insert or update it just to be extra safe.
 Here is an example in the insert function in an auth branch application.

insert: function (userId, doc) {
        doc.name = doc.name.slice(0,255);
        doc.description = doc.description.slice(0,255);
        doc.pay_to = doc.pay_to.slice(0,255);
        doc.receipt_mark = doc.receipt_mark.slice(0,1);
        doc.rate = doc.rate.slice(0,4);

At least you know if you fubard your validation code client or server side
or something else went sideways that at least you don't have data over
writes.  Clearly you take this even farther and perform all kinds of tricks
and stunts.  Just found this refreshing and wanted to share.

Slice is so refreshing.

Steeve


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.