That's almost what I need: I intercepted the call, but I also should retrieve the group/s of the current user
angular.module('umbraco.services').config([
'$httpProvider',
function ($httpProvider) {
$httpProvider.interceptors.push(function ($q, $injector) {
return {
'response': function (response) {
var userS = $injector.get('userService');
if (response.config.url.indexOf("/umbraco/GetGridConfig") === 0) {
userS.getCurrentUser().then(function (currentUser) {
//check the user group and return the filtered
//response.data
});
}
}
};
});
}]);
if the only way is the userService then I should wait for the userS.getCurrentUser() to finish the call before return the data,
but I can't find the way to do it...
I would probably create my own API endpoint to replace GetGridConfig in that one it should be possible to read the groups of the current user and mangle with the object.
Then angular should intercept the request in order to change the url to eg. /umbraco/backoffice/MyGridConfig/GetGridConfig.
Override or Replace "/umbraco/GetGridConfig"
Hi!
I'd like to change the behaviour of the method that returns the list of the Grid editors without edit the source code.
If I'm correct is this one.
What I want is just to filter the editors based on the user group.
Thankyou :D
S
Hi Stefano
You can intercept the call in angular, and replace it with your own. Check out this article (the last section) describing how its done: https://24days.in/umbraco-cms/2015/umbraco-7-back-office-tweaks/
Woah, thank you!
That's almost what I need: I intercepted the call, but I also should retrieve the group/s of the current user
if the only way is the userService then I should wait for the userS.getCurrentUser() to finish the call before return the data, but I can't find the way to do it...
Could you give me a hint? :D
Thank you
S
Hi Stefano
I would probably create my own API endpoint to replace
GetGridConfig
in that one it should be possible to read the groups of the current user and mangle with the object.Then angular should intercept the request in order to change the url to eg.
/umbraco/backoffice/MyGridConfig/GetGridConfig
.Oh... Yeah... Ehmmm... I feel very stupid right now...
I didn't think about it, sorry :D
Thank you again!
H5YR!
S
is working on a reply...