cms.user = new function(){
  var _authenticated = false;
  
  this.setAuthenticated = function(authenticated){
    _authenticated = authenticated;
  };
  
  this.isAuthenticated = function(){
    return _authenticated;
  };
  
  this.getLang = function(){
    return cms.user.getAttribute('lang', null, 'user');
  };
  
  this.getAttribute = function(name, defaultValue, namespace){
    var attributes = cms.data.user.attributes;
    if(attributes[namespace] === undefined){
      return defaultValue;
    }
    else if(attributes[namespace][name] === undefined){
      return defaultValue;
    } else {
      return attributes[namespace][name];
    }
  };
};
