diff --git a/js/controllers/website-controller.js b/js/controllers/website-controller.js index 5d0513a..572d535 100644 --- a/js/controllers/website-controller.js +++ b/js/controllers/website-controller.js @@ -354,7 +354,8 @@ app.controller('websiteCtrl', [ vm.Shares.invite = function (r) { var pkg = Auth.oauth3.pkg('www@daplie.com'); return pkg.invite({ - email: r.shareEmail + comment: r.shareEmail + , email: r.shareEmail , domain: r.domain , tld: r.tld , sld: r.sld @@ -374,6 +375,24 @@ app.controller('websiteCtrl', [ vm.listSites(); }); }; + vm.Shares.list = function (r) { + var pkg = Auth.oauth3.pkg('www@daplie.com'); + console.log('actual record:'); + console.log(r); + return pkg.listShares({ + domain: r.domain + , hostname: r.domain + , tld: r.tld + , sld: r.sld + //, sub: r.sub + , path: r.sharePath + }).then(function (result) { + console.log('list shares result:'); + console.log(result); + r.sharedWith = result.data; + //r.usersnames = r.sharedWith.map().join(','); + }); + }; vm.listSites = function () { var sites = []; diff --git a/js/www@daplie.com.js b/js/www@daplie.com.js index e7613d2..8c54092 100644 --- a/js/www@daplie.com.js +++ b/js/www@daplie.com.js @@ -28,6 +28,21 @@ OAUTH3._pkgs['www@daplie.com'] = { + '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, strip: opts.strip, path: opts.path }) ; } +, listShares: function (opts) { + var providerUri = opts.audience; + var session = opts.session; + + // TODO needs a way to have api and assets for audience + return OAUTH3.request({ + method: 'GET' + , url: OAUTH3.url.normalize(providerUri) + + '/api/www@daplie.com/acl/shares/' + (opts.domain || opts.hostname) + + '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, path: opts.path }) + , session: session + }).then(function (result) { + return result; + }); + } , invite: function (opts) { var providerUri = opts.audience; var session = opts.session; @@ -37,7 +52,15 @@ OAUTH3._pkgs['www@daplie.com'] = { method: 'POST' , url: OAUTH3.url.normalize(providerUri) + '/api/www@daplie.com/acl/shares/' + (opts.domain || opts.hostname) - + '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, mode: opts.mode, path: opts.path }) + + '?' + OAUTH3.utils.query.stringify({ + tld: opts.tld + , sld: opts.sld + /*, sub: opts.sub*/ + , mode: opts.mode + , path: opts.path + , email: opts.email + , comment: opts.comment + }) , session: session }).then(function (result) { return result; diff --git a/templates/website.html b/templates/website.html index 20d0b97..aad5aa6 100644 --- a/templates/website.html +++ b/templates/website.html @@ -98,12 +98,17 @@