conjur-asset-ui 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.git-hooks/pre_commit/ensure_livescript_compiled.rb +31 -0
- data/.git-hooks/pre_commit/trailing_whitespace.rb +26 -0
- data/.gitignore +20 -0
- data/.overcommit.yml +5 -0
- data/.project +18 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +41 -0
- data/Rakefile +3 -0
- data/compile_ls +6 -0
- data/conjur-asset-ui.gemspec +37 -0
- data/lib/conjur/command/ui.rb +46 -0
- data/lib/conjur/webserver/api_proxy.rb +94 -0
- data/lib/conjur/webserver/authorize.rb +28 -0
- data/lib/conjur/webserver/conjur_info.rb +33 -0
- data/lib/conjur/webserver/home.rb +42 -0
- data/lib/conjur/webserver/login.rb +57 -0
- data/lib/conjur/webserver/renderer.rb +34 -0
- data/lib/conjur/webserver/server.rb +113 -0
- data/lib/conjur-asset-ui-version.rb +7 -0
- data/lib/conjur-asset-ui.rb +7 -0
- data/livescript/views/audit.ls +136 -0
- data/public/_client_code.html +42 -0
- data/public/_client_libs.html +24 -0
- data/public/css/bootstrap.css +7 -0
- data/public/css/styles.less +461 -0
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +229 -0
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/images/conjur-logo.svg +26 -0
- data/public/images/icon-client-pc.svg +12 -0
- data/public/images/icon-environment.png +0 -0
- data/public/images/icon-person.svg +12 -0
- data/public/images/icon-policy.png +0 -0
- data/public/images/icon-resource.png +0 -0
- data/public/images/icon-service-dots.svg +13 -0
- data/public/images/icon-variable.png +0 -0
- data/public/index.html.erb +62 -0
- data/public/js/init.js +107 -0
- data/public/js/lib/JSXTransformer.js +10862 -0
- data/public/js/lib/async.js +958 -0
- data/public/js/lib/backbone.js +2 -0
- data/public/js/lib/bootstrap.js +6 -0
- data/public/js/lib/date.extensions.js +141 -0
- data/public/js/lib/less.js +16 -0
- data/public/js/lib/moment.js +7768 -0
- data/public/js/lib/pace.js +2 -0
- data/public/js/lib/prelude-browser-min.js +1 -0
- data/public/js/lib/react-bootstrap.js +5346 -0
- data/public/js/lib/react-bootstrap.min.js +4 -0
- data/public/js/lib/sorted-set.no-require.js +1170 -0
- data/public/js/lib/sorted-set.no-require.js.txt +6 -0
- data/public/js/lib/underscore-min.js +6 -0
- data/public/js/lib/underscore.string.min.js +1 -0
- data/public/js/main.js +57 -0
- data/public/js/models/groupRecord.js +70 -0
- data/public/js/models/hostRecord.js +55 -0
- data/public/js/models/layerRecord.js +77 -0
- data/public/js/models/namespace.js +10 -0
- data/public/js/models/policyList.js +14 -0
- data/public/js/models/policyRecord.js +54 -0
- data/public/js/models/record.js +85 -0
- data/public/js/models/resourceList.js +69 -0
- data/public/js/models/userList.js +20 -0
- data/public/js/models/userRecord.js +70 -0
- data/public/js/models/variableList.js +16 -0
- data/public/js/models/variableRecord.js +73 -0
- data/public/js/routers.js +205 -0
- data/public/js/views/annotations.js +36 -0
- data/public/js/views/audit.js +363 -0
- data/public/js/views/dashboard.js +67 -0
- data/public/js/views/generic.js +115 -0
- data/public/js/views/group.js +61 -0
- data/public/js/views/groups.js +30 -0
- data/public/js/views/host.js +64 -0
- data/public/js/views/hosts.js +30 -0
- data/public/js/views/layer.js +92 -0
- data/public/js/views/layers.js +30 -0
- data/public/js/views/mixins/search.js +15 -0
- data/public/js/views/mixins/tabs.js +114 -0
- data/public/js/views/namespaces.js +40 -0
- data/public/js/views/navSearch.js +25 -0
- data/public/js/views/owned.js +178 -0
- data/public/js/views/permissions.js +188 -0
- data/public/js/views/policies.js +28 -0
- data/public/js/views/policy.js +43 -0
- data/public/js/views/resource.js +39 -0
- data/public/js/views/role.js +41 -0
- data/public/js/views/searchResults.js +145 -0
- data/public/js/views/time.js +14 -0
- data/public/js/views/user.js +68 -0
- data/public/js/views/users.js +31 -0
- data/public/js/views/variable.js +70 -0
- data/public/js/views/variables.js +30 -0
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/support/jasmine.yml +112 -0
- data/spec/javascripts/support/jasmine_helper.rb +22 -0
- data/spec/javascripts/support/run.html.erb +23 -0
- data/spec/javascripts/views/AuditSpec.js +22 -0
- data/spec/javascripts/views/AuditSpec.ls +18 -0
- data/vendor/prelude-ls/.gitignore +2 -0
- data/vendor/prelude-ls/.travis.yml +3 -0
- data/vendor/prelude-ls/CHANGELOG.md +81 -0
- data/vendor/prelude-ls/LICENSE +22 -0
- data/vendor/prelude-ls/Makefile +50 -0
- data/vendor/prelude-ls/README.md +15 -0
- data/vendor/prelude-ls/browser/prelude-browser-min.js +1 -0
- data/vendor/prelude-ls/browser/prelude-browser.js +1172 -0
- data/vendor/prelude-ls/lib/Func.js +40 -0
- data/vendor/prelude-ls/lib/List.js +602 -0
- data/vendor/prelude-ls/lib/Num.js +129 -0
- data/vendor/prelude-ls/lib/Obj.js +153 -0
- data/vendor/prelude-ls/lib/Str.js +68 -0
- data/vendor/prelude-ls/lib/index.js +164 -0
- data/vendor/prelude-ls/package.json +50 -0
- data/vendor/prelude-ls/package.ls +46 -0
- data/vendor/prelude-ls/src/Func.ls +17 -0
- data/vendor/prelude-ls/src/List.ls +299 -0
- data/vendor/prelude-ls/src/Num.ls +83 -0
- data/vendor/prelude-ls/src/Obj.ls +61 -0
- data/vendor/prelude-ls/src/Str.ls +32 -0
- data/vendor/prelude-ls/src/index.ls +56 -0
- data/vendor/prelude-ls/test/Func.ls +36 -0
- data/vendor/prelude-ls/test/List.ls +751 -0
- data/vendor/prelude-ls/test/Num.ls +258 -0
- data/vendor/prelude-ls/test/Obj.ls +145 -0
- data/vendor/prelude-ls/test/Prelude.ls +49 -0
- data/vendor/prelude-ls/test/Str.ls +208 -0
- data/vendor/prelude-ls/test/browser.html +5 -0
- metadata +369 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
// Underscore.js 1.5.2
|
2
|
+
// http://underscorejs.org
|
3
|
+
// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
4
|
+
// Underscore may be freely distributed under the MIT license.
|
5
|
+
(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?(this._wrapped=n,void 0):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.5.2";var A=j.each=j.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var E="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(E);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},j.find=j.detect=function(n,t,r){var e;return O(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var O=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:O(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,function(n){return n[t]})},j.where=function(n,t,r){return j.isEmpty(t)?r?void 0:[]:j[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},j.findWhere=function(n,t){return j.where(n,t,!0)},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);if(!t&&j.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>e.computed&&(e={value:n,computed:a})}),e.value},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);if(!t&&j.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a<e.computed&&(e={value:n,computed:a})}),e.value},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return arguments.length<2||r?n[j.random(n.length-1)]:j.shuffle(n).slice(0,Math.max(0,t))};var k=function(n){return j.isFunction(n)?n:function(t){return t[n]}};j.sortBy=function(n,t,r){var e=k(t);return j.pluck(j.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={},i=null==r?j.identity:k(r);return A(t,function(r,a){var o=i.call(e,r,a,t);n(u,o,r)}),u}};j.groupBy=F(function(n,t,r){(j.has(n,t)?n[t]:n[t]=[]).push(r)}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=null==r?j.identity:k(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}return i},j.toArray=function(n){return n?j.isArray(n)?o.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},j.size=function(n){return null==n?0:n.length===+n.length?n.length:j.keys(n).length},j.first=j.head=j.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.indexOf(t,n)>=0})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},j.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var r={};return t||(t=j.identity),function(){var e=t.apply(this,arguments);return j.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},j.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(o.call(arguments,1)))},j.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var c=function(){o=r.leading===!1?0:new Date,a=null,i=n.apply(e,u)};return function(){var l=new Date;o||r.leading!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u)):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o;return function(){i=this,u=arguments,a=new Date;var c=function(){var l=new Date-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u)))},l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u)),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=w||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o))return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var I={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};I.unescape=j.invert(I.escape);var T={escape:new RegExp("["+j.keys(I.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(I.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(T[n],function(t){return I[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this);
|
6
|
+
//# sourceMappingURL=underscore-min.map
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(e,n){"use strict";function r(e,n){var r,t,u=e.toLowerCase();for(n=[].concat(n),r=0;n.length>r;r+=1)if(t=n[r]){if(t.test&&t.test(e))return!0;if(t.toLowerCase()===u)return!0}}var t=n.prototype.trim,u=n.prototype.trimRight,i=n.prototype.trimLeft,l=function(e){return 1*e||0},o=function(e,n){if(1>n)return"";for(var r="";n>0;)1&n&&(r+=e),n>>=1,e+=e;return r},a=[].slice,c=function(e){return null==e?"\\s":e.source?e.source:"["+g.escapeRegExp(e)+"]"},s={lt:"<",gt:">",quot:'"',amp:"&",apos:"'"},f={};for(var p in s)f[s[p]]=p;f["'"]="#39";var h=function(){function e(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var r=o,t=function(){return t.cache.hasOwnProperty(arguments[0])||(t.cache[arguments[0]]=t.parse(arguments[0])),t.format.call(null,t.cache[arguments[0]],arguments)};return t.format=function(t,u){var i,l,o,a,c,s,f,p=1,g=t.length,d="",m=[];for(l=0;g>l;l++)if(d=e(t[l]),"string"===d)m.push(t[l]);else if("array"===d){if(a=t[l],a[2])for(i=u[p],o=0;a[2].length>o;o++){if(!i.hasOwnProperty(a[2][o]))throw new Error(h('[_.sprintf] property "%s" does not exist',a[2][o]));i=i[a[2][o]]}else i=a[1]?u[a[1]]:u[p++];if(/[^s]/.test(a[8])&&"number"!=e(i))throw new Error(h("[_.sprintf] expecting number but found %s",e(i)));switch(a[8]){case"b":i=i.toString(2);break;case"c":i=n.fromCharCode(i);break;case"d":i=parseInt(i,10);break;case"e":i=a[7]?i.toExponential(a[7]):i.toExponential();break;case"f":i=a[7]?parseFloat(i).toFixed(a[7]):parseFloat(i);break;case"o":i=i.toString(8);break;case"s":i=(i=n(i))&&a[7]?i.substring(0,a[7]):i;break;case"u":i=Math.abs(i);break;case"x":i=i.toString(16);break;case"X":i=i.toString(16).toUpperCase()}i=/[def]/.test(a[8])&&a[3]&&i>=0?"+"+i:i,s=a[4]?"0"==a[4]?"0":a[4].charAt(1):" ",f=a[6]-n(i).length,c=a[6]?r(s,f):"",m.push(a[5]?i+c:c+i)}return m.join("")},t.cache={},t.parse=function(e){for(var n=e,r=[],t=[],u=0;n;){if(null!==(r=/^[^\x25]+/.exec(n)))t.push(r[0]);else if(null!==(r=/^\x25{2}/.exec(n)))t.push("%");else{if(null===(r=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(n)))throw new Error("[_.sprintf] huh?");if(r[2]){u|=1;var i=[],l=r[2],o=[];if(null===(o=/^([a-z_][a-z_\d]*)/i.exec(l)))throw new Error("[_.sprintf] huh?");for(i.push(o[1]);""!==(l=l.substring(o[0].length));)if(null!==(o=/^\.([a-z_][a-z_\d]*)/i.exec(l)))i.push(o[1]);else{if(null===(o=/^\[(\d+)\]/.exec(l)))throw new Error("[_.sprintf] huh?");i.push(o[1])}r[2]=i}else u|=2;if(3===u)throw new Error("[_.sprintf] mixing positional and named placeholders is not (yet) supported");t.push(r)}n=n.substring(r[0].length)}return t},t}(),g={VERSION:"2.3.0",isBlank:function(e){return null==e&&(e=""),/^\s*$/.test(e)},stripTags:function(e){return null==e?"":n(e).replace(/<\/?[^>]+>/g,"")},capitalize:function(e){return e=null==e?"":n(e),e.charAt(0).toUpperCase()+e.slice(1)},chop:function(e,r){return null==e?[]:(e=n(e),r=~~r,r>0?e.match(new RegExp(".{1,"+r+"}","g")):[e])},clean:function(e){return g.strip(e).replace(/\s+/g," ")},count:function(e,r){if(null==e||null==r)return 0;e=n(e),r=n(r);for(var t=0,u=0,i=r.length;;){if(u=e.indexOf(r,u),-1===u)break;t++,u+=i}return t},chars:function(e){return null==e?[]:n(e).split("")},swapCase:function(e){return null==e?"":n(e).replace(/\S/g,function(e){return e===e.toUpperCase()?e.toLowerCase():e.toUpperCase()})},escapeHTML:function(e){return null==e?"":n(e).replace(/[&<>"']/g,function(e){return"&"+f[e]+";"})},unescapeHTML:function(e){return null==e?"":n(e).replace(/\&([^;]+);/g,function(e,r){var t;return r in s?s[r]:(t=r.match(/^#x([\da-fA-F]+)$/))?n.fromCharCode(parseInt(t[1],16)):(t=r.match(/^#(\d+)$/))?n.fromCharCode(~~t[1]):e})},escapeRegExp:function(e){return null==e?"":n(e).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},splice:function(e,n,r,t){var u=g.chars(e);return u.splice(~~n,~~r,t),u.join("")},insert:function(e,n,r){return g.splice(e,n,0,r)},include:function(e,r){return""===r?!0:null==e?!1:-1!==n(e).indexOf(r)},join:function(){var e=a.call(arguments),n=e.shift();return null==n&&(n=""),e.join(n)},lines:function(e){return null==e?[]:n(e).split("\n")},reverse:function(e){return g.chars(e).reverse().join("")},startsWith:function(e,r){return""===r?!0:null==e||null==r?!1:(e=n(e),r=n(r),e.length>=r.length&&e.slice(0,r.length)===r)},endsWith:function(e,r){return""===r?!0:null==e||null==r?!1:(e=n(e),r=n(r),e.length>=r.length&&e.slice(e.length-r.length)===r)},succ:function(e){return null==e?"":(e=n(e),e.slice(0,-1)+n.fromCharCode(e.charCodeAt(e.length-1)+1))},titleize:function(e){return null==e?"":(e=n(e).toLowerCase(),e.replace(/(?:^|\s|-)\S/g,function(e){return e.toUpperCase()}))},camelize:function(e){return g.trim(e).replace(/[-_\s]+(.)?/g,function(e,n){return n?n.toUpperCase():""})},underscored:function(e){return g.trim(e).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},dasherize:function(e){return g.trim(e).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()},classify:function(e){return g.titleize(n(e).replace(/[\W_]/g," ")).replace(/\s/g,"")},humanize:function(e){return g.capitalize(g.underscored(e).replace(/_id$/,"").replace(/_/g," "))},trim:function(e,r){return null==e?"":!r&&t?t.call(e):(r=c(r),n(e).replace(new RegExp("^"+r+"+|"+r+"+$","g"),""))},ltrim:function(e,r){return null==e?"":!r&&i?i.call(e):(r=c(r),n(e).replace(new RegExp("^"+r+"+"),""))},rtrim:function(e,r){return null==e?"":!r&&u?u.call(e):(r=c(r),n(e).replace(new RegExp(r+"+$"),""))},truncate:function(e,r,t){return null==e?"":(e=n(e),t=t||"...",r=~~r,e.length>r?e.slice(0,r)+t:e)},prune:function(e,r,t){if(null==e)return"";if(e=n(e),r=~~r,t=null!=t?n(t):"...",r>=e.length)return e;var u=function(e){return e.toUpperCase()!==e.toLowerCase()?"A":" "},i=e.slice(0,r+1).replace(/.(?=\W*\w*$)/g,u);return i=i.slice(i.length-2).match(/\w\w/)?i.replace(/\s*\S+$/,""):g.rtrim(i.slice(0,i.length-1)),(i+t).length>e.length?e:e.slice(0,i.length)+t},words:function(e,n){return g.isBlank(e)?[]:g.trim(e,n).split(n||/\s+/)},pad:function(e,r,t,u){e=null==e?"":n(e),r=~~r;var i=0;switch(t?t.length>1&&(t=t.charAt(0)):t=" ",u){case"right":return i=r-e.length,e+o(t,i);case"both":return i=r-e.length,o(t,Math.ceil(i/2))+e+o(t,Math.floor(i/2));default:return i=r-e.length,o(t,i)+e}},lpad:function(e,n,r){return g.pad(e,n,r)},rpad:function(e,n,r){return g.pad(e,n,r,"right")},lrpad:function(e,n,r){return g.pad(e,n,r,"both")},sprintf:h,vsprintf:function(e,n){return n.unshift(e),h.apply(null,n)},toNumber:function(e,n){return e?(e=g.trim(e),e.match(/^-?\d+(?:\.\d+)?$/)?l(l(e).toFixed(~~n)):0/0):0},numberFormat:function(e,n,r,t){if(isNaN(e)||null==e)return"";e=e.toFixed(~~n),t="string"==typeof t?t:",";var u=e.split("."),i=u[0],l=u[1]?(r||".")+u[1]:"";return i.replace(/(\d)(?=(?:\d{3})+$)/g,"$1"+t)+l},strRight:function(e,r){if(null==e)return"";e=n(e),r=null!=r?n(r):r;var t=r?e.indexOf(r):-1;return~t?e.slice(t+r.length,e.length):e},strRightBack:function(e,r){if(null==e)return"";e=n(e),r=null!=r?n(r):r;var t=r?e.lastIndexOf(r):-1;return~t?e.slice(t+r.length,e.length):e},strLeft:function(e,r){if(null==e)return"";e=n(e),r=null!=r?n(r):r;var t=r?e.indexOf(r):-1;return~t?e.slice(0,t):e},strLeftBack:function(e,n){if(null==e)return"";e+="",n=null!=n?""+n:n;var r=e.lastIndexOf(n);return~r?e.slice(0,r):e},toSentence:function(e,n,r,t){n=n||", ",r=r||" and ";var u=e.slice(),i=u.pop();return e.length>2&&t&&(r=g.rtrim(n)+r),u.length?u.join(n)+r+i:i},toSentenceSerial:function(){var e=a.call(arguments);return e[3]=!0,g.toSentence.apply(g,e)},slugify:function(e){if(null==e)return"";var r="ąàáäâãåæăćęèéëêìíïîłńòóöôõøśșțùúüûñçżź",t="aaaaaaaaaceeeeeiiiilnoooooosstuuuunczz",u=new RegExp(c(r),"g");return e=n(e).toLowerCase().replace(u,function(e){var n=r.indexOf(e);return t.charAt(n)||"-"}),g.dasherize(e.replace(/[^\w\s-]/g,""))},surround:function(e,n){return[n,e,n].join("")},quote:function(e,n){return g.surround(e,n||'"')},unquote:function(e,n){return n=n||'"',e[0]===n&&e[e.length-1]===n?e.slice(1,e.length-1):e},exports:function(){var e={};for(var n in this)this.hasOwnProperty(n)&&!n.match(/^(?:include|contains|reverse)$/)&&(e[n]=this[n]);return e},repeat:function(e,r,t){if(null==e)return"";if(r=~~r,null==t)return o(n(e),r);for(var u=[];r>0;u[--r]=e);return u.join(t)},naturalCmp:function(e,r){if(e==r)return 0;if(!e)return-1;if(!r)return 1;for(var t=/(\.\d+)|(\d+)|(\D+)/g,u=n(e).toLowerCase().match(t),i=n(r).toLowerCase().match(t),l=Math.min(u.length,i.length),o=0;l>o;o++){var a=u[o],c=i[o];if(a!==c){var s=parseInt(a,10);if(!isNaN(s)){var f=parseInt(c,10);if(!isNaN(f)&&s-f)return s-f}return c>a?-1:1}}return u.length===i.length?u.length-i.length:r>e?-1:1},levenshtein:function(e,r){if(null==e&&null==r)return 0;if(null==e)return n(r).length;if(null==r)return n(e).length;e=n(e),r=n(r);for(var t,u,i=[],l=0;r.length>=l;l++)for(var o=0;e.length>=o;o++)u=l&&o?e.charAt(o-1)===r.charAt(l-1)?t:Math.min(i[o],i[o-1],t)+1:l+o,t=i[o],i[o]=u;return i.pop()},toBoolean:function(e,n,t){return"number"==typeof e&&(e=""+e),"string"!=typeof e?!!e:(e=g.trim(e),r(e,n||["true","1"])?!0:r(e,t||["false","0"])?!1:void 0)}};g.strip=g.trim,g.lstrip=g.ltrim,g.rstrip=g.rtrim,g.center=g.lrpad,g.rjust=g.lpad,g.ljust=g.rpad,g.contains=g.include,g.q=g.quote,g.toBool=g.toBoolean,"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(module.exports=g),exports._s=g),"function"==typeof define&&define.amd&&define("underscore.string",[],function(){return g}),e._=e._||{},e._.string=e._.str=g}(this,String);
|
data/public/js/main.js
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
// var components = {};
|
2
|
+
// var globalIds;
|
3
|
+
|
4
|
+
function updateNamespace(ns) {
|
5
|
+
conjur.app.namespace.currentNamespace = ns;
|
6
|
+
// it won't work with reactjs 11.0 -- state should be set from within component
|
7
|
+
// components[kind].setState({currentNamespace: ns, members: lists[kind].members(ns)});
|
8
|
+
}
|
9
|
+
|
10
|
+
$(document).ready(function() {
|
11
|
+
conjur.initialize();
|
12
|
+
|
13
|
+
_.mixin(_.str.exports());
|
14
|
+
|
15
|
+
// Use delegation to avoid initial DOM selection and allow all matching elements to bubble
|
16
|
+
$(document).delegate('a', 'click', function(evt) {
|
17
|
+
// Get the anchor href and protcol
|
18
|
+
var href = $(this).attr('href');
|
19
|
+
var protocol = this.protocol + '//';
|
20
|
+
|
21
|
+
// Ensure the protocol is not part of URL, meaning its relative.
|
22
|
+
// Stop the event bubbling to ensure the link will not cause a page refresh.
|
23
|
+
if (href.slice(0,protocol.length) !== protocol && href[0] !== '#') {
|
24
|
+
evt.preventDefault();
|
25
|
+
|
26
|
+
// Note by using Backbone.history.navigate, router events will not be
|
27
|
+
// triggered. If this is a problem, change this to navigate on your
|
28
|
+
// router.
|
29
|
+
Backbone.history.navigate(href, {trigger:true});
|
30
|
+
}
|
31
|
+
});
|
32
|
+
|
33
|
+
conjur.app.router = new conjur.Workspace();
|
34
|
+
|
35
|
+
conjur.app.router.on('all', function(route, router) {
|
36
|
+
console.log('router.all', route, conjur.app.flash);
|
37
|
+
|
38
|
+
if (route != 'route') {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
|
42
|
+
if (conjur.app.flash) {
|
43
|
+
var old = conjur.app.flash;
|
44
|
+
conjur.app.flash = null;
|
45
|
+
var $flash = $('#flash');
|
46
|
+
var $text = $('.text', $flash);
|
47
|
+
$text.text(old);
|
48
|
+
$flash.show();
|
49
|
+
} else {
|
50
|
+
$('#flash').hide();
|
51
|
+
}
|
52
|
+
});
|
53
|
+
|
54
|
+
Backbone.history.start({pushState: true});
|
55
|
+
|
56
|
+
React.renderComponent(conjur.views.NavSearchForm(null), document.getElementById('inlineSearchContainer'));
|
57
|
+
});
|
@@ -0,0 +1,70 @@
|
|
1
|
+
(function(conjur, $, async, errback) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var Generic = this.Generic;
|
5
|
+
|
6
|
+
var Group = this.Group = function(args) {
|
7
|
+
if (!(this instanceof Group)) {
|
8
|
+
return new Group(args);
|
9
|
+
}
|
10
|
+
|
11
|
+
var superArguments = Array.prototype.slice.call(arguments);
|
12
|
+
superArguments.unshift('group');
|
13
|
+
Generic.apply(this, superArguments);
|
14
|
+
|
15
|
+
return undefined;
|
16
|
+
};
|
17
|
+
|
18
|
+
Group.prototype = Object.create(Generic.prototype);
|
19
|
+
Group.prototype.constructor = Group;
|
20
|
+
|
21
|
+
Group.prototype.fetch = function(callback, custom_errback) {
|
22
|
+
var self = this,
|
23
|
+
id = this.id;
|
24
|
+
|
25
|
+
if (typeof(custom_errback) === 'undefined') {
|
26
|
+
custom_errback = errback; // reset to default
|
27
|
+
}
|
28
|
+
|
29
|
+
async.parallel([
|
30
|
+
this.attributes.bind(this),
|
31
|
+
this.ownedResources.bind(this),
|
32
|
+
function(cb) {
|
33
|
+
$.ajax({
|
34
|
+
url: '/api/authz/'
|
35
|
+
+ conjur.app.configuration.account
|
36
|
+
+ '/roles/group/'
|
37
|
+
+ id
|
38
|
+
+ '?members',
|
39
|
+
success: function(result) {
|
40
|
+
cb(null, result);
|
41
|
+
},
|
42
|
+
error: cb
|
43
|
+
});
|
44
|
+
},
|
45
|
+
this.allRoles.bind(this),
|
46
|
+
this.resource.bind(this)
|
47
|
+
], function(err, results) {
|
48
|
+
if (err) {
|
49
|
+
return custom_errback(err.status);
|
50
|
+
}
|
51
|
+
|
52
|
+
callback({
|
53
|
+
group: results[0],
|
54
|
+
owned: results[1],
|
55
|
+
members: results[2],
|
56
|
+
roles: results[3],
|
57
|
+
annotations: results[4].annotations
|
58
|
+
});
|
59
|
+
|
60
|
+
return undefined;
|
61
|
+
});
|
62
|
+
};
|
63
|
+
|
64
|
+
}).bind(conjur.models.Record)
|
65
|
+
(
|
66
|
+
conjur,
|
67
|
+
jQuery,
|
68
|
+
async,
|
69
|
+
conjur.utils.errback
|
70
|
+
);
|
@@ -0,0 +1,55 @@
|
|
1
|
+
(function(conjur, async, errback) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var Generic = this.Generic;
|
5
|
+
|
6
|
+
var Host = this.Host = function(args) {
|
7
|
+
if (!(this instanceof Host)) {
|
8
|
+
return new Host(args);
|
9
|
+
}
|
10
|
+
|
11
|
+
var superArguments = Array.prototype.slice.call(arguments);
|
12
|
+
superArguments.unshift('host');
|
13
|
+
Generic.apply(this, superArguments);
|
14
|
+
|
15
|
+
return undefined;
|
16
|
+
};
|
17
|
+
|
18
|
+
Host.prototype = Object.create(Generic.prototype);
|
19
|
+
Host.prototype.constructor = Host;
|
20
|
+
|
21
|
+
Host.prototype.fetch = function(callback, custom_errback) {
|
22
|
+
var self = this,
|
23
|
+
id = this.id;
|
24
|
+
|
25
|
+
if (typeof(custom_errback) === 'undefined') {
|
26
|
+
custom_errback = errback; // reset to default
|
27
|
+
}
|
28
|
+
|
29
|
+
async.parallel([
|
30
|
+
this.attributes.bind(this),
|
31
|
+
this.ownedResources.bind(this),
|
32
|
+
this.allRoles.bind(this),
|
33
|
+
this.resource.bind(this)
|
34
|
+
], function(err, results) {
|
35
|
+
if (err) {
|
36
|
+
return custom_errback(err.status);
|
37
|
+
}
|
38
|
+
|
39
|
+
callback({
|
40
|
+
host: results[0],
|
41
|
+
owned: results[1],
|
42
|
+
roles: results[2],
|
43
|
+
annotations: results[3].annotations
|
44
|
+
});
|
45
|
+
|
46
|
+
return undefined;
|
47
|
+
});
|
48
|
+
};
|
49
|
+
|
50
|
+
}).bind(conjur.models.Record)
|
51
|
+
(
|
52
|
+
conjur,
|
53
|
+
async,
|
54
|
+
conjur.utils.errback
|
55
|
+
);
|
@@ -0,0 +1,77 @@
|
|
1
|
+
(function(conjur, $, _, async, errback) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var Generic = this.Generic;
|
5
|
+
|
6
|
+
var Layer = this.Layer = function(args) {
|
7
|
+
if (!(this instanceof Layer)) {
|
8
|
+
return new Layer(args);
|
9
|
+
}
|
10
|
+
|
11
|
+
var superArguments = Array.prototype.slice.call(arguments);
|
12
|
+
superArguments.unshift('layer');
|
13
|
+
Generic.apply(this, superArguments);
|
14
|
+
|
15
|
+
return undefined;
|
16
|
+
};
|
17
|
+
|
18
|
+
Layer.prototype = Object.create(Generic.prototype);
|
19
|
+
Layer.prototype.constructor = Layer;
|
20
|
+
|
21
|
+
Layer.prototype.fetch = function(callback, custom_errback) {
|
22
|
+
var self = this,
|
23
|
+
id = this.id;
|
24
|
+
|
25
|
+
if (typeof(custom_errback) === 'undefined') {
|
26
|
+
custom_errback = errback; // reset to default
|
27
|
+
}
|
28
|
+
|
29
|
+
function members(role) {
|
30
|
+
return function(cb) {
|
31
|
+
$.ajax({
|
32
|
+
url: '/api/authz/'
|
33
|
+
+ conjur.app.configuration.account
|
34
|
+
+ '/roles/'
|
35
|
+
+ role
|
36
|
+
+ '?members',
|
37
|
+
success: function(result) {
|
38
|
+
cb(null, result);
|
39
|
+
},
|
40
|
+
error: cb
|
41
|
+
});
|
42
|
+
};
|
43
|
+
}
|
44
|
+
|
45
|
+
async.parallel([
|
46
|
+
this.attributes.bind(this),
|
47
|
+
this.ownedResources.bind(this),
|
48
|
+
members('@/layer/' + id + '/use_host'),
|
49
|
+
members('@/layer/' + id + '/admin_host'),
|
50
|
+
this.allRoles.bind(this),
|
51
|
+
this.resource.bind(this)
|
52
|
+
], function(err, results) {
|
53
|
+
if (err) {
|
54
|
+
return custom_errback(err.status);
|
55
|
+
}
|
56
|
+
|
57
|
+
callback({
|
58
|
+
layer: results[0],
|
59
|
+
owned: results[1],
|
60
|
+
users: _.pluck(results[2], 'member'),
|
61
|
+
admins: _.pluck(results[3], 'member'),
|
62
|
+
roles: results[4],
|
63
|
+
annotations: results[5].annotations
|
64
|
+
});
|
65
|
+
|
66
|
+
return undefined;
|
67
|
+
});
|
68
|
+
};
|
69
|
+
|
70
|
+
}).bind(conjur.models.Record)
|
71
|
+
(
|
72
|
+
conjur,
|
73
|
+
jQuery,
|
74
|
+
_,
|
75
|
+
async,
|
76
|
+
conjur.utils.errback
|
77
|
+
);
|
@@ -0,0 +1,54 @@
|
|
1
|
+
(function(conjur, async, errback) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var Generic = this.Generic;
|
5
|
+
|
6
|
+
var Policy = this.Policy = function(args) {
|
7
|
+
if (!(this instanceof Policy)) {
|
8
|
+
return new Policy(args);
|
9
|
+
}
|
10
|
+
|
11
|
+
var superArguments = Array.prototype.slice.call(arguments);
|
12
|
+
superArguments.unshift('policy');
|
13
|
+
Generic.apply(this, superArguments);
|
14
|
+
|
15
|
+
return undefined;
|
16
|
+
};
|
17
|
+
|
18
|
+
Policy.prototype = Object.create(Generic.prototype);
|
19
|
+
Policy.prototype.constructor = Policy;
|
20
|
+
|
21
|
+
Policy.prototype.fetch = function(callback, custom_errback) {
|
22
|
+
var self = this,
|
23
|
+
id = this.id;
|
24
|
+
|
25
|
+
if (typeof(custom_errback) == 'undefined') {
|
26
|
+
custom_errback = errback; // reset to default
|
27
|
+
}
|
28
|
+
|
29
|
+
async.parallel([
|
30
|
+
this.resource.bind(this),
|
31
|
+
this.ownedResources.bind(this),
|
32
|
+
this.allRoles.bind(this)
|
33
|
+
], function(err, results) {
|
34
|
+
if (err) {
|
35
|
+
return custom_errback(err.status);
|
36
|
+
}
|
37
|
+
|
38
|
+
callback({
|
39
|
+
policy: results[0],
|
40
|
+
owned: results[1],
|
41
|
+
roles: results[2],
|
42
|
+
annotations: results[0].annotations
|
43
|
+
});
|
44
|
+
|
45
|
+
return undefined;
|
46
|
+
});
|
47
|
+
};
|
48
|
+
|
49
|
+
}).bind(conjur.models.Record)
|
50
|
+
(
|
51
|
+
conjur,
|
52
|
+
async,
|
53
|
+
conjur.utils.errback
|
54
|
+
);
|
@@ -0,0 +1,85 @@
|
|
1
|
+
(function(conjur, $, errback) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var Generic = this.Generic = function(kind, id) {
|
5
|
+
this.kind = kind;
|
6
|
+
this.id = id;
|
7
|
+
};
|
8
|
+
|
9
|
+
function ajax(url, callback) {
|
10
|
+
$.ajax({
|
11
|
+
url: url,
|
12
|
+
success: function(data) {
|
13
|
+
callback(null, data);
|
14
|
+
},
|
15
|
+
error: callback
|
16
|
+
});
|
17
|
+
}
|
18
|
+
|
19
|
+
Generic.prototype.attributes = function(callback) {
|
20
|
+
var id = this.id;
|
21
|
+
|
22
|
+
ajax('/api/'
|
23
|
+
+ conjur.utils.pluralize(this.kind)
|
24
|
+
+ '/'
|
25
|
+
+ window.encodeURIComponent(id),
|
26
|
+
callback);
|
27
|
+
};
|
28
|
+
|
29
|
+
Generic.prototype.resource = function(callback) {
|
30
|
+
ajax('/api/authz/'
|
31
|
+
+ conjur.app.configuration.account
|
32
|
+
+ '/resources/'
|
33
|
+
+ this.kind
|
34
|
+
+ '/'
|
35
|
+
+ window.encodeURIComponent(this.id),
|
36
|
+
callback);
|
37
|
+
};
|
38
|
+
|
39
|
+
Generic.prototype.ownedResources = function(callback) {
|
40
|
+
var id = this.id;
|
41
|
+
var roleid = [this.kind, this.id].join(':');
|
42
|
+
|
43
|
+
ajax('/api/authz/'
|
44
|
+
+ conjur.app.configuration.account
|
45
|
+
+ '/resources?owner='
|
46
|
+
+ roleid,
|
47
|
+
function(err, result) {
|
48
|
+
if (typeof result.filter === 'function') {
|
49
|
+
result = result.filter(function(item) {
|
50
|
+
// assets of 'secret' kind are internal
|
51
|
+
return item.id.split(':')[1] != 'secret';
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
callback(err, result);
|
56
|
+
});
|
57
|
+
};
|
58
|
+
|
59
|
+
Generic.prototype.allRoles = function(callback) {
|
60
|
+
ajax('/api/authz/'
|
61
|
+
+ conjur.app.configuration.account
|
62
|
+
+ '/roles/'
|
63
|
+
+ window.encodeURIComponent(this.kind)
|
64
|
+
+ '/'
|
65
|
+
+ window.encodeURIComponent(this.id)
|
66
|
+
+ '?all',
|
67
|
+
callback);
|
68
|
+
};
|
69
|
+
|
70
|
+
Generic.prototype.fetch = function(callback) {
|
71
|
+
this.attributes(function(err, data) {
|
72
|
+
if (err) {
|
73
|
+
return errback(err);
|
74
|
+
}
|
75
|
+
|
76
|
+
return callback(data);
|
77
|
+
});
|
78
|
+
};
|
79
|
+
|
80
|
+
}).bind(conjur.models.Record)
|
81
|
+
(
|
82
|
+
conjur,
|
83
|
+
jQuery,
|
84
|
+
conjur.utils.errback
|
85
|
+
);
|
@@ -0,0 +1,69 @@
|
|
1
|
+
(function(conjur, $, _) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
conjur.models.ResourceList = function(kind, options) {
|
5
|
+
var List = function() {
|
6
|
+
this._members = null;
|
7
|
+
this.namespaces = null;
|
8
|
+
this.options = options || {};
|
9
|
+
|
10
|
+
if ( !this.options.idSelector ) {
|
11
|
+
this.options.idSelector = function(member) {
|
12
|
+
var idTokens = member.id.split(':');
|
13
|
+
return idTokens[idTokens.length-1];
|
14
|
+
};
|
15
|
+
}
|
16
|
+
|
17
|
+
if ( !this.options.namespaceSelector ) {
|
18
|
+
this.options.namespaceSelector = function(member) {
|
19
|
+
return member.identifier.split('/')[0];
|
20
|
+
};
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
List.prototype.members = function(namespace) {
|
25
|
+
var result;
|
26
|
+
|
27
|
+
if ( namespace === "" ) {
|
28
|
+
result = _.clone(this._members);
|
29
|
+
} else {
|
30
|
+
result = this._members.filter(function(o) {
|
31
|
+
return this.options.namespaceSelector(o) === namespace;
|
32
|
+
}.bind(this));
|
33
|
+
}
|
34
|
+
|
35
|
+
return result.sort(function(a, b) {
|
36
|
+
return a.identifier.localeCompare(b.identifier);
|
37
|
+
});
|
38
|
+
};
|
39
|
+
|
40
|
+
List.prototype.fetch = function(callback) {
|
41
|
+
if ( this._members )
|
42
|
+
return callback(this);
|
43
|
+
|
44
|
+
var self = this;
|
45
|
+
|
46
|
+
$.ajax({
|
47
|
+
url: "/api/authz/" + encodeURIComponent(conjur.app.configuration.account) + "/resources/" + encodeURIComponent(kind),
|
48
|
+
success: function(data) {
|
49
|
+
var filter, idSelector;
|
50
|
+
|
51
|
+
if ( filter = this.options.filter ) {
|
52
|
+
data = _.filter(data, filter);
|
53
|
+
}
|
54
|
+
|
55
|
+
self._members = data;
|
56
|
+
self._members.forEach(function(member) {
|
57
|
+
member.identifier = this.options.idSelector(member);
|
58
|
+
}.bind(this));
|
59
|
+
self.namespaces = _.unique(self._members.map(this.options.namespaceSelector)).sort();
|
60
|
+
callback(self);
|
61
|
+
}.bind(this)
|
62
|
+
});
|
63
|
+
|
64
|
+
};
|
65
|
+
|
66
|
+
return new List();
|
67
|
+
};
|
68
|
+
|
69
|
+
})(conjur, jQuery, _);
|
@@ -0,0 +1,20 @@
|
|
1
|
+
(function(conjur) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
conjur.models.UserList = function() {
|
5
|
+
var options = {
|
6
|
+
namespaceSelector: function(member) {
|
7
|
+
var idTokens = member.id.split('@');
|
8
|
+
|
9
|
+
if (idTokens.length > 1) {
|
10
|
+
return idTokens.slice(1, idTokens.length-1).join['@'];
|
11
|
+
} else {
|
12
|
+
return null;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
};
|
16
|
+
|
17
|
+
return conjur.models.ResourceList('user', options);
|
18
|
+
};
|
19
|
+
|
20
|
+
})(conjur);
|
@@ -0,0 +1,70 @@
|
|
1
|
+
(function(conjur, $, async, errback) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var Generic = this.Generic;
|
5
|
+
|
6
|
+
var User = this.User = function(args) {
|
7
|
+
if (!(this instanceof User)) {
|
8
|
+
return new User(args);
|
9
|
+
}
|
10
|
+
|
11
|
+
var superArguments = Array.prototype.slice.call(arguments);
|
12
|
+
superArguments.unshift('user');
|
13
|
+
Generic.apply(this, superArguments);
|
14
|
+
|
15
|
+
return undefined;
|
16
|
+
};
|
17
|
+
|
18
|
+
User.prototype = Object.create(Generic.prototype);
|
19
|
+
User.prototype.constructor = User;
|
20
|
+
|
21
|
+
User.prototype.publicKeys = function(callback, custom_errback) {
|
22
|
+
$.ajax({
|
23
|
+
url: '/api/pubkeys/' + window.encodeURIComponent(this.id),
|
24
|
+
success: function(data) {
|
25
|
+
callback(null, data.split('\n').filter(function(d) {
|
26
|
+
return d.trim().length > 0;
|
27
|
+
}));
|
28
|
+
},
|
29
|
+
error: callback
|
30
|
+
});
|
31
|
+
};
|
32
|
+
|
33
|
+
User.prototype.fetch = function(callback, custom_errback) {
|
34
|
+
var self = this,
|
35
|
+
id = this.id;
|
36
|
+
|
37
|
+
if (typeof(custom_errback) === 'undefined') {
|
38
|
+
custom_errback = errback; // reset to default
|
39
|
+
}
|
40
|
+
|
41
|
+
async.parallel([
|
42
|
+
this.attributes.bind(this),
|
43
|
+
this.ownedResources.bind(this),
|
44
|
+
this.allRoles.bind(this),
|
45
|
+
this.resource.bind(this),
|
46
|
+
this.publicKeys.bind(this)
|
47
|
+
], function(err, results) {
|
48
|
+
if (err) {
|
49
|
+
return custom_errback(err.status);
|
50
|
+
}
|
51
|
+
|
52
|
+
callback({
|
53
|
+
user: results[0],
|
54
|
+
owned: results[1],
|
55
|
+
roles: results[2],
|
56
|
+
annotations: results[3].annotations,
|
57
|
+
pubkeys: results[4]
|
58
|
+
});
|
59
|
+
|
60
|
+
return undefined;
|
61
|
+
});
|
62
|
+
};
|
63
|
+
|
64
|
+
}).bind(conjur.models.Record)
|
65
|
+
(
|
66
|
+
conjur,
|
67
|
+
jQuery,
|
68
|
+
async,
|
69
|
+
conjur.utils.errback
|
70
|
+
);
|