Get user role from api?


#1

Is it a way to get the role description of the logged user?

I’m using angular, but any js code would be fine.

Thank you.


#2

I just solve that by creating a custom script and calling it form my angular app, but now arise a new problem, if I’m logged as an administrator I get results back otherwise I get POST http://dreamfactory.jr…pp.com/rest/system/script/add/ 403 (Forbidden)

My question: Is there a way to access to custom scripts being a registered user instead of an administrator?

Server side (custom script)

    var path = "system/role/" + event.id;
var role = platform.api.get(path);
    return role; 

Browser side (angular)

var getRole = function (roleID) {
$http({
  method: 'POST',
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  url: 'http://dreamfactory.jr...pp.com/rest/system/script/userrole/',
  data: $.param({ is_user_script:true, id:roleID }), 
})
.success(function(response) { console.debug("role data",response); });

}


#3

SOLVED:

I had to go to the specific role, choose access tab > System Access, then: