list shares
This commit is contained in:
parent
b5195b1a14
commit
439e58bb25
|
@ -354,7 +354,8 @@ app.controller('websiteCtrl', [
|
||||||
vm.Shares.invite = function (r) {
|
vm.Shares.invite = function (r) {
|
||||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||||
return pkg.invite({
|
return pkg.invite({
|
||||||
email: r.shareEmail
|
comment: r.shareEmail
|
||||||
|
, email: r.shareEmail
|
||||||
, domain: r.domain
|
, domain: r.domain
|
||||||
, tld: r.tld
|
, tld: r.tld
|
||||||
, sld: r.sld
|
, sld: r.sld
|
||||||
|
@ -374,6 +375,24 @@ app.controller('websiteCtrl', [
|
||||||
vm.listSites();
|
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 () {
|
vm.listSites = function () {
|
||||||
var sites = [];
|
var sites = [];
|
||||||
|
|
|
@ -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 })
|
+ '?' + 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) {
|
, invite: function (opts) {
|
||||||
var providerUri = opts.audience;
|
var providerUri = opts.audience;
|
||||||
var session = opts.session;
|
var session = opts.session;
|
||||||
|
@ -37,7 +52,15 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
, url: OAUTH3.url.normalize(providerUri)
|
, url: OAUTH3.url.normalize(providerUri)
|
||||||
+ '/api/www@daplie.com/acl/shares/' + (opts.domain || opts.hostname)
|
+ '/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
|
, session: session
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -98,12 +98,17 @@
|
||||||
<button class="btn btn-default" ng-click="vm.Sites.contents(r)">List Files</button>
|
<button class="btn btn-default" ng-click="vm.Sites.contents(r)">List Files</button>
|
||||||
</td>
|
</td>
|
||||||
<td ng-bind="r.path">Sites > blogs > blog.jane.smith.net</td>
|
<td ng-bind="r.path">Sites > blogs > blog.jane.smith.net</td>
|
||||||
<td ng-bind="r.users">jane@smith.net, jack@smith.net, friend@gmail.com</td>
|
<td><span ng-repeat="share in r.sharedWith" ng-if="!share.me">
|
||||||
|
<span ng-bind="share.path">/</span>
|
||||||
|
<span ng-bind="share.comment">friend@email.com</span>
|
||||||
|
(<span ng-bind="share.mode">rwx</span>)
|
||||||
|
</span></td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" ng-model="r.shareEmail" placeholder="ex: john@example.com" />
|
<input type="text" ng-model="r.shareEmail" placeholder="ex: john@example.com" />
|
||||||
<input type="text" ng-model="r.sharePath" placeholder="/" />
|
<input type="text" ng-model="r.sharePath" placeholder="/" />
|
||||||
<input type="text" ng-model="r.shareMode" placeholder="rwx (read, write, invite)" />
|
<input type="text" ng-model="r.shareMode" placeholder="rwx (read, write, invite)" />
|
||||||
<button class="btn btn-default" ng-click="vm.Shares.invite(r)">Invite</button>
|
<button class="btn btn-default" ng-click="vm.Shares.invite(r)">Invite</button>
|
||||||
|
<button class="btn btn-default" ng-click="vm.Shares.list(r)">List Shares</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in New Issue