/** * Current user. * * @param context the context * @return the user object */ public static OEUser currentUser(Context context) { if (current_user != null) { return current_user; } else { if (OpenERPAccountManager.isAnyUser(context)) { List<OEUser> accounts = OpenERPAccountManager.fetchAllAccounts(context); for (OEUser user : accounts) { if (user.isIsactive()) { return user; } } } } return null; }
/** * Checks if is any user. * * @param context the context * @return true, if is any user */ public static boolean isAnyUser(Context context) { boolean flag = false; if (current_user != null) { flag = true; } else { List<OEUser> accounts = OpenERPAccountManager.fetchAllAccounts(context); if (accounts != null) { for (OEUser user : accounts) { if (user.isIsactive()) { flag = true; current_user = user; break; } } } } return flag; }