How can I best implement feature flags in AngularJS / Rails? -


for app rails backend , angularjs @ front, how implement feature flags or in other words conditional features per user?

this video gave glimpse on how that, looks quite crude me.

i using rollout gem authorization. in case, feature flags implemented totally on client side, feel "not secure , robust way of disabling/enabling features"

i can't use <% if $rollout.active?(:chat, current_user) %> in partials since not erbs, html pages used angular templates.

thank in advance.

so use jwt. jwt token can use rails app authenticate users. imagine hotel card. depending on how paid, access services or others. let access garage or breakfast.

going technical details, when user logs in in app, rails create 1 of tokens , rails can put there flag want, can send token containing:

{user_id: 3, rollout: true, admin: true} 

so in angular side, can parse token , activate sections need, along lines:

<div ng-if="user.rollout"></div> 

so based on in token, sections of page appear.

the token cannot tampered, end user can't modify because server reject it.

in angular cannot else, user create user object , put flags true, rails api decides user can see, maximum use empty admin page without data, not avoidable.

if want learn more jwt, here idea , here examples (including rails one)


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -