Skip to content

Commit 76ccacd

Browse files
committed
allow setting of username to assign OnWaterApp data (admin by default)
1 parent f05f675 commit 76ccacd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/main/java/org/ecocean/OnWaterApp.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class OnWaterApp {
3737
public static String apiUsername = null;
3838
public static String apiPassword = null;
3939
public static String apiUrlPrefix = null;
40+
public static String wildbookUsername = null;
4041
public static Properties props = null; // will be set by init()
4142
public static LocalAssetStore assetStore;
4243

@@ -52,6 +53,8 @@ public static void init(String context) {
5253
apiUsername = props.getProperty("apiUsername");
5354
apiPassword = props.getProperty("apiPassword");
5455
apiUrlPrefix = props.getProperty("apiUrlPrefix");
56+
wildbookUsername = props.getProperty("wildbookUsername");
57+
if (!Util.stringExists(wildbookUsername)) wildbookUsername = "admin";
5558
}
5659

5760
public static boolean hasBeenInitialized() {
@@ -280,7 +283,7 @@ public static Encounter toEncounter(JSONObject jin, Shepherd myShepherd,
280283

281284
enc.setAppUserId(jin.optString("user", null));
282285

283-
enc.setSubmitterID("admin");
286+
enc.setSubmitterID(wildbookUsername);
284287
enc.setState("unapproved");
285288

286289
Survey survey = toSurvey(jin.optJSONObject("trip"), enc, myShepherd);

src/main/resources/bundles/on-water-app.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ apiUsername=CHANGEME
22
apiPassword=CHANGEME
33
apiUrlPrefix=https://api.onwaterapp.com
44

5+
#wildbookUsername=admin
56

0 commit comments

Comments
 (0)