i username created record associated record. ought happen on server , not via originating client connection. place see on server access username in canperformaction. possible rewrite message insert username before record created/updated in storage connector? , if write own storage connector, username not passed storage connector api. can give me other options or guidance?
usernames (as other data) can added outgoing messages using datatransform functions. please find in-depth explanation here:
http://deepstream.io/tutorials/transforming-data.html
passing usernames storage connector bit trickier since there no 1:1 relationship between record , user. if you'd create private record i’d rather make username part of record name, e.g.
private-johndoe/iam7f3vy-2mgd656jrx3di and use permissionhandler’s canperformaction method make sure recordnames start ‘private-‘ continue name of user that's interacting them
canperformaction: function( username, message, callback ) { if( message.topic === c.topic.record ) { var recordname = message.data[ 0 ]; if( recordname.substring( 0, 8 ) === 'private-' ) { var providedusername = recordname.substring( 8, recordname.indexof( '/' ) ); callback( null, providedusername === username ); } } else { callback( null, true ); } }
Comments
Post a Comment