X-Git-Url: http://git.onelab.eu/?p=myops.git;a=blobdiff_plain;f=web%2Fquery%2Fvendor%2Fcouchapp%2Fevently%2Faccount%2F_init.js;fp=web%2Fquery%2Fvendor%2Fcouchapp%2Fevently%2Faccount%2F_init.js;h=4ead6485d5f6e7d9b6003779938707835071c795;hp=0000000000000000000000000000000000000000;hb=85070b3d456667f238051af1a2f1f2a0c12300ab;hpb=607f0e13927eb18075c375fa9ba5527da4fcbb44 diff --git a/web/query/vendor/couchapp/evently/account/_init.js b/web/query/vendor/couchapp/evently/account/_init.js new file mode 100644 index 0000000..4ead648 --- /dev/null +++ b/web/query/vendor/couchapp/evently/account/_init.js @@ -0,0 +1,16 @@ +function() { + var elem = $(this); + $$(this).userCtx = null; + $.couch.session({ + success : function(r) { + var userCtx = r.userCtx; + if (userCtx.name) { + elem.trigger("loggedIn", [r]); + } else if (userCtx.roles.indexOf("_admin") != -1) { + elem.trigger("adminParty"); + } else { + elem.trigger("loggedOut"); + }; + } + }); +} \ No newline at end of file