Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
fix(enroll): permission on enrollment process (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelje authored and ajsb85 committed Jul 19, 2017
1 parent f08db95 commit 90f0724
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.flyve.mdm.agent"
android:versionCode="40"
android:versionName="1.0.42">
android:versionCode="50"
android:versionName="1.0.52">

<!-- For writing logfiles -->
<uses-permission android:name="android.permisson.READ_EXTERNAL_STORAGE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public static String getSyncWebData(String url, String method, Map<String, Strin
conn.setConnectTimeout(timeout);
conn.setReadTimeout(readtimeout);
conn.setInstanceFollowRedirects(true);
conn.setRequestMethod(method);

if(header != null) {
for (Map.Entry<String, String> entry : header.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ public void run() {

JSONObject jsonFullSession = new JSONObject(dataFullSession);
jsonSession = jsonFullSession.getJSONObject("session");
JSONObject jsonActiveProfile = jsonSession.getJSONObject("glpiactiveprofile");
String profileId = jsonActiveProfile.getString("id");
String profileId = jsonSession.getString("plugin_flyvemdm_guest_profiles_id");

cache.setProfileId( profileId );

// STEP 3 Activated the profile
final String dataActiveProfile = getSyncWebData(routes.changeActiveProfile(cache.getProfileId()), "GET", header);
final String dataActiveProfile = getSyncWebData(routes.changeActiveProfile(cache.getProfileId()), "POST", header);
final String errorActiveProfile = manageError(dataActiveProfile);
if(!errorActiveProfile.equals("")) {
EnrollmentHelper.runOnUI(new Runnable() {
Expand Down Expand Up @@ -253,7 +253,7 @@ public void run() {
FlyveLog.e(error);
EnrollmentHelper.runOnUI(new Runnable() {
public void run() {
callback.onError(error);
callback.onError(context.getResources().getString(R.string.ERROR_INTERNAL));
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/flyve/mdm/agent/utils/Helpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static String base64encode(String text) {
public static String getDeviceSerial() {
String serial;
if(Build.SERIAL.equalsIgnoreCase("unknown")) {
serial = "ABCDEFGHIJ123456";
serial = "ABCDEFGHIJ1234568";
} else {
serial = Build.SERIAL;
}
Expand Down
31 changes: 23 additions & 8 deletions app/src/main/java/org/flyve/mdm/agent/utils/Routes.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class Routes {

private String url;
DataStorage cache;
private DataStorage cache;

/**
* Constructor
Expand All @@ -54,15 +54,20 @@ public Routes(Context context) {
* @return String with the url
*/
public String initSession(String userToken) {
return url + "/initSession?user_token=" + userToken;
String str = url + "/initSession?user_token=" + userToken;
FlyveLog.d("initSession URL: ", str);
return str;
}

/**
* getFullSession url
* @return String with the url
*/
public String getFullSession() {
return url + "/getFullSession";
String str = url + "/getFullSession";
FlyveLog.d("getFullSession: ", str);
return str;

}

/**
Expand All @@ -71,15 +76,19 @@ public String getFullSession() {
* @return String with the url
*/
public String changeActiveProfile(String profileId) {
return url + "/changeActiveProfile?profile_id=" + profileId;
String str = url + "/changeActiveProfile?profiles_id=" + profileId;
FlyveLog.d("changeActiveProfile: ", str);
return str;
}

/**
* PluginFlyvemdmAgent url
* @return String with the url
*/
public String pluginFlyvemdmAgent() {
return url + "/PluginFlyvemdmAgent";
String str = url + "/PluginFlyvemdmAgent";
FlyveLog.d("pluginFlyvemdmAgent: ", str);
return str;
}

/**
Expand All @@ -88,7 +97,9 @@ public String pluginFlyvemdmAgent() {
* @return String with the url
*/
public String pluginFlyvemdmAgent(String agentId) {
return url + "/PluginFlyvemdmAgent/" + agentId;
String str = url + "/PluginFlyvemdmAgent/" + agentId;
FlyveLog.d("pluginFlyvemdmAgent: ", str);
return str;
}

/**
Expand All @@ -97,7 +108,9 @@ public String pluginFlyvemdmAgent(String agentId) {
* @return String url
*/
public String PluginFlyvemdmFile(String fileId, String sessionToken) {
return url + "/PluginFlyvemdmFile/" + fileId + "?session_token=" + sessionToken;
String str = url + "/PluginFlyvemdmFile/" + fileId + "?session_token=" + sessionToken;
FlyveLog.d("PluginFlyvemdmFile: ", str);
return str;
}

/**
Expand All @@ -106,7 +119,9 @@ public String PluginFlyvemdmFile(String fileId, String sessionToken) {
* @return String url
*/
public String PluginFlyvemdmPackage(String fileId, String sessionToken) {
return url + "/PluginFlyvemdmPackage/" + fileId + "?session_token=" + sessionToken;
String str = url + "/PluginFlyvemdmPackage/" + fileId + "?session_token=" + sessionToken;
FlyveLog.d("PluginFlyvemdmPackage: ", str);
return str;
}


Expand Down

0 comments on commit 90f0724

Please sign in to comment.