ContextPermissions = { sString : PHP_Unserialize(''), map : PHP_Unserialize('') /* sString : PHP_Unserialize('a:7:{s:4:"site";a:1:{i:3;i:4;}s:4:"page";a:2:{i:256;i:4;i:258;i:4;}s:4:"area";a:1:{i:0;i:0;}s:7:"content";a:1:{i:0;i:28;}s:8:"assetlib";a:1:{i:2;i:4;}s:5:"asset";a:1:{i:0;i:20;}s:4:"user";a:1:{i:0;i:4;}}'), sString : PHP_Unserialize('a:7:{s:4:"site";a:1:{i:0;i:2044;}s:4:"page";a:1:{i:0;i:2044;}s:4:"area";a:1:{i:0;i:2044;}s:7:"content";a:1:{i:0;i:2044;}s:8:"assetlib";a:1:{i:0;i:2044;}s:5:"asset";a:1:{i:0;i:2044;}s:4:"user";a:1:{i:0;i:2044;}}'), map : PHP_Unserialize('a:10:{i:0;a:2:{s:4:"name";s:4:"none";s:4:"mask";s:1:"2";}i:1;a:2:{s:4:"name";s:4:"view";s:4:"mask";s:1:"4";}i:2;a:2:{s:4:"name";s:6:"create";s:4:"mask";s:1:"8";}i:3;a:2:{s:4:"name";s:4:"edit";s:4:"mask";s:2:"16";}i:4;a:2:{s:4:"name";s:6:"delete";s:4:"mask";s:2:"32";}i:5;a:2:{s:4:"name";s:7:"reorder";s:4:"mask";s:2:"64";}i:6;a:2:{s:4:"name";s:7:"approve";s:4:"mask";s:3:"128";}i:7;a:2:{s:4:"name";s:8:"rollback";s:4:"mask";s:3:"256";}i:8;a:2:{s:4:"name";s:7:"publish";s:4:"mask";s:3:"512";}i:9;a:2:{s:4:"name";s:6:"import";s:4:"mask";s:4:"1024";}}') */ }; ContextPermissions.checkObject = function(action,object,objectId){ objectId = (!objectId ? 0 : objectId); if(typeof(this.sString[object][objectId])=='undefined' && typeof(this.sString[object][0])!='undefined') return this.check(action,object,0); return this.check(action,object,objectId); } ContextPermissions.check = function(action,object,objectId){ var items = this.parseBitMask(this.sString[object][objectId]); for(var x=0;x 0){ for(var i=0,n=0; i<=obj; i=(1*Math.pow(2,n)),n++) end = i; result[result.length] = this.map[this.degradeBitMask(end)]['name']; obj = (obj - end); } return result; } ContextPermissions.degradeBitMask = function(num){ var result = 0; for(var cnt=0; num>=2; num=(num/2),cnt++) result = cnt; return result; } /*------------------------------------- // Library for deserializing; -------------------------------------*/ function PHP_Unserialize(input) {var result = PHP_Unserialize_(input);return result[0];} function PHP_Unserialize_(input){var length = 0; switch (input.charAt(0)) { /** * Array */ case 'a': length = PHP_Unserialize_GetLength(input); input = input.substr(String(length).length + 4); var arr = new Array(); var key = null; var value = null; for (var i=0; i