engines/adva_rbac/app/helpers/roles_helper.rb
def authorize_elements(object = nil)
    object_path = object ? "/#{object.class.name.downcase.pluralize}/#{object.id}" : ''
    javascript_tag <<-js
      var uid = Cookie.get('uid');
      if(uid) {
        $.ajax({
          url: '/users/' + uid + '/roles#{object_path}.js',
          type: 'get',
          async: false,
          dataType: 'script'
        });
      }
      var aid = Cookie.get('aid');
      if(aid) {
        $(document).ready(function() { authorize_elements(['anonymous-' + aid]); });
      }
    js
  end
# Includes a javascript tag that will load a javascript snippet
# generated by the RolesController. This snippet will contain roles data
# for the current user and toggle visibility for authorized elements.
Includes a javascript tag that will load a javascript snippet
generated by the RolesController. This snippet will contain roles data
for the current user and toggle visibility for authorized elements.
Includes a javascript tag that will load a javascript snippet generated by the RolesController . This snippet will contain roles data for the current user and toggle visibility for authorized elements .
def authorize_elements(object = nil)
    object_path = object ? "/#{object.class.name.downcase.pluralize}/#{object.id}" : ''
    javascript_tag <<-js
      var uid = Cookie.get('uid');
      if(uid) {
        $.ajax({
          url: '/users/' + uid + '/roles#{object_path}.js',
          type: 'get',
          async: false,
          dataType: 'script'
        });
      }
      var aid = Cookie.get('aid');
      if(aid) {
        $(document).ready(function() { authorize_elements(['anonymous-' + aid]); });
      }
    js
  end
def authorize_elements ( object = nil ) object_path = object ? "/#{object.class.name.downcase.pluralize}/#{object.id}" : '' javascript_tag <<-js 
      var uid = Cookie.get('uid');
      if(uid) {
        $.ajax({
          url: '/users/' + uid + '/roles #{ object_path } .js',
          type: 'get',
          async: false,
          dataType: 'script'
        });
      }
      var aid = Cookie.get('aid');
      if(aid) {
        $(document).ready(function() { authorize_elements(['anonymous-' + aid]); });
      }
     js end
Includes a javascript tag that will load a javascript snippet
generated by the RolesController.
Includes a javascript tag that will load a javascript snippet generated by the RolesController .
object