//because we have to create an OUser record and a User Object, we need a transaction
DbHelper.requestTransaction();
if (role==null) profile=dao.create(username, password);
else profile=dao.create(username, password,role);
ORID userRid = ((ORID)profile.field("user")).getIdentity();
ORole friendRole=RoleDao.createFriendRole(username);
friendRole.getDocument().field(RoleService.FIELD_ASSIGNABLE,true);
friendRole.getDocument().field(RoleService.FIELD_MODIFIABLE,false);