With that in mind, lets talk about a recent situation I came across that very much speaks to this point. In short, in the course of talking about the 7.x technology, the question arose of how one would go about retrieving a list of Roles assigned to a given user. Because we have to do this through a JavaScript based controller, techniques we might have used in the past are no longer applicable.
For the purposes of our example we will assume that we wish to retrieve the list of Roles assigned to the currently logged in user, in turn allowing us to see some details about the manner in which we interact with the current user, also a common need and one that also differs greatly.
The following Gist will allow us to retrieve the Roles:
NOTE: Roles are only accessible to Admin level users and as such, the above code would only function if executed by a user with Admin privileges. In turn, it would also be best to specify a particular user ID rather than relying on the current user.
Hola Angel, sabe si existe alguna manera de gestionar en Roles las zolapas del ZuckerReports 2.1?
ReplyDeleteNo, lo siento pero no sé.
DeleteCan we include this logic into a SugarLogic Expression in the javascript function?
ReplyDeleteisMemberOfRole would be the new SugarLogic Expression
Hola Ángel hay una manera de restringir una vista personalizada desde roles, o bien obtener los roles de un usuario, no importando si no es administrador, solamente los roles de ese usuario?
ReplyDelete