-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Fix : User Roles not added to create, update or delete calls #374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
42aacdf
d7d87a3
220a133
83c0f92
2234a10
173c5d4
2c5b77f
5b40a58
5a167a9
176f1b9
67c7670
5de33ac
5b8aa22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,7 +80,7 @@ Auth.prototype.getUserRoles = function() { | |
return Promise.resolve(this.userRoles); | ||
} | ||
if (this.rolePromise) { | ||
return rolePromise; | ||
return this.rolePromise; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
} | ||
this.rolePromise = this._loadRoles(); | ||
return this.rolePromise; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,12 +56,19 @@ function del(config, auth, className, objectId) { | |
}); | ||
} | ||
return Promise.resolve({}); | ||
}).then(() => { | ||
if (!auth.isMaster) { | ||
return auth.getUserRoles(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we could add an auth.resolveACL() that would return a proper ACL query object (into a promise result) given the current state of the auth. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @flovilmart do you mean the auth.resolveACL will ask the server to get the new state of the user ? Sorry but my English is not perfect :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean a method on auth like: function queryACLConstraint() { This inspired by the way we build the ACL options around the app, this way we centralize that logic. |
||
}else{ | ||
return Promise.resolve(); | ||
} | ||
}).then(() => { | ||
var options = {}; | ||
if (!auth.isMaster) { | ||
options.acl = ['*']; | ||
if (auth.user) { | ||
options.acl.push(auth.user.id); | ||
options.acl = options.acl.concat(auth.userRoles); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change this because, by default the sessionToken is passed. The result of this never fail.