}
if (appUsersAttributes!=null) {
ODocument attrObj = profile.field(UserDao.ATTRIBUTES_VISIBLE_BY_REGISTERED_USER);
if (attrObj==null) attrObj=new ODocument(UserDao.USER_ATTRIBUTES_CLASS);
//preserve the _social field
OTrackedMap oldSocial = (OTrackedMap)attrObj.field("_social");
((ObjectNode)(appUsersAttributes)).remove("_social");
attrObj.fromJSON(appUsersAttributes.toString());
if (oldSocial!=null) attrObj.field("_social",oldSocial);
PermissionsHelper.grantRead(attrObj, RoleDao.getRole(DefaultRoles.REGISTERED_USER.toString()));
PermissionsHelper.grantRead(attrObj, RoleDao.getFriendRole());