Skip to content

Instantly share code, notes, and snippets.

Hussain hussainb

  • India, Pune
Block or report user

Report or block hussainb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
hussainb / google-drive.js
Created Dec 24, 2017 — forked from MrToph/google-drive.js
Google Drive API v3 fetch
View google-drive.js
import GoogleSignIn from 'react-native-google-sign-in'
const url = ''
const uploadUrl = ''
const boundaryString = 'foo_bar_baz' // can be anything unique, needed for multipart upload
let apiToken = null

I am keeping this as a reference to

Working with SailsJS v0.10-rc5: I am trying to keep the magic of blueprint controllers while at the same time protecting some model attributes from being changed by users on the default routes. I.e.: prevent access to the is_admin attribute on regular CRUD routes and implement a promote action or something similar on the UserController which makes the neccessary checks.

In order to do this, I came up with the following policy in combination with a small addition to the model definitions:

// file: api/policies/protectedAttributes.js

View beforeBlueprint.js
* beforeBlueprint
* @module :: Policy
* @description :: Simple policy to enable hooks into the model which can act upon req, res objects.
* @docs ::!documentation/policies
var actionUtil = require( 'sails/lib/hooks/blueprints/actionUtil' );
View beforeCreate.js
* beforeCreate
* @module :: Policy
* @description :: Simple policy to inject the user creating a record into the records values.
* Assumes req.user && to be set when a user is logged in.
* @docs ::!documentation/policies
You can’t perform that action at this time.