mirror of https://github.com/MISP/misp-bump
fix self signed flag not being pushed correctly to misp instance
parent
6216543b7b
commit
6d5ea12a84
|
@ -6,6 +6,7 @@ import android.graphics.Shader;
|
||||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -122,6 +123,11 @@ public class ProfileActivity extends AppCompatActivity {
|
||||||
|
|
||||||
MaterialPreferenceText description = findViewById(R.id.description);
|
MaterialPreferenceText description = findViewById(R.id.description);
|
||||||
description.setSubtitle(organisation.getDescription());
|
description.setSubtitle(organisation.getDescription());
|
||||||
|
|
||||||
|
Role[] roles = preferenceManager.getRoles();
|
||||||
|
for (Role role : roles) {
|
||||||
|
Log.d("ROLES", role.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -36,8 +35,17 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
|
||||||
private SyncInformation syncInformation;
|
private SyncInformation syncInformation;
|
||||||
|
|
||||||
private boolean fabMenuExpanded;
|
private boolean fabMenuExpanded;
|
||||||
private boolean dataLocallyChanged;
|
|
||||||
|
|
||||||
|
private View.OnClickListener onUploadClicked = v -> {
|
||||||
|
preferenceManager.addSyncInformation(syncInformation);
|
||||||
|
Intent upload = new Intent(SyncInfoDetailActivity.this, UploadActivity.class);
|
||||||
|
upload.putExtra(UploadActivity.EXTRA_SYNC_INFO_UUID, syncInformation.getUuid().toString());
|
||||||
|
startActivity(upload);
|
||||||
|
};
|
||||||
|
|
||||||
|
private View.OnClickListener onDownloadClicked = v -> {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -59,11 +67,6 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
||||||
if (dataLocallyChanged) {
|
|
||||||
syncInformation.setSyncedWithRemote(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
preferenceManager.addSyncInformation(syncInformation);
|
preferenceManager.addSyncInformation(syncInformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +188,7 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
|
||||||
menuBackground.setClickable(false);
|
menuBackground.setClickable(false);
|
||||||
|
|
||||||
fab.setImageDrawable(close);
|
fab.setImageDrawable(close);
|
||||||
|
assert close != null;
|
||||||
close.start();
|
close.start();
|
||||||
|
|
||||||
closeAnimation.start();
|
closeAnimation.start();
|
||||||
|
@ -193,6 +197,7 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
|
||||||
menuBackground.setClickable(true);
|
menuBackground.setClickable(true);
|
||||||
|
|
||||||
fab.setImageDrawable(open);
|
fab.setImageDrawable(open);
|
||||||
|
assert open != null;
|
||||||
open.start();
|
open.start();
|
||||||
|
|
||||||
openAnimation.start();
|
openAnimation.start();
|
||||||
|
@ -204,17 +209,8 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
|
||||||
menuBackground.setClickable(false);
|
menuBackground.setClickable(false);
|
||||||
fab.setOnClickListener(expandCollapseClick);
|
fab.setOnClickListener(expandCollapseClick);
|
||||||
|
|
||||||
fabUpload.setOnClickListener(view -> {
|
fabUpload.setOnClickListener(onUploadClicked);
|
||||||
preferenceManager.addSyncInformation(syncInformation);
|
fabDownload.setOnClickListener(onDownloadClicked);
|
||||||
Intent upload = new Intent(SyncInfoDetailActivity.this, UploadActivity.class);
|
|
||||||
upload.putExtra(UploadActivity.EXTRA_SYNC_INFO_UUID, syncInformation.getUuid().toString());
|
|
||||||
startActivity(upload);
|
|
||||||
});
|
|
||||||
|
|
||||||
fabDownload.setOnClickListener(view -> {
|
|
||||||
// TODO download content from MISP instance
|
|
||||||
Snackbar.make(view, "Not implemented yet", Snackbar.LENGTH_LONG).show();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateContent() {
|
private void populateContent() {
|
||||||
|
@ -239,28 +235,28 @@ public class SyncInfoDetailActivity extends AppCompatActivity {
|
||||||
allowSelfSigned.setChecked(syncInformation.getRemote().getServer().getSelfSigned());
|
allowSelfSigned.setChecked(syncInformation.getRemote().getServer().getSelfSigned());
|
||||||
allowSelfSigned.setOnCheckedChangeListener((cb, b) -> {
|
allowSelfSigned.setOnCheckedChangeListener((cb, b) -> {
|
||||||
syncInformation.getRemote().getServer().setSelfSigned(b);
|
syncInformation.getRemote().getServer().setSelfSigned(b);
|
||||||
dataLocallyChanged = true;
|
syncInformation.setHasUnpublishedChanges(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
MaterialPreferenceSwitch allowPush = findViewById(R.id.switch_allow_push);
|
MaterialPreferenceSwitch allowPush = findViewById(R.id.switch_allow_push);
|
||||||
allowPush.setChecked(syncInformation.getRemote().getServer().getPush());
|
allowPush.setChecked(syncInformation.getRemote().getServer().getPush());
|
||||||
allowPush.setOnCheckedChangeListener((cb, b) -> {
|
allowPush.setOnCheckedChangeListener((cb, b) -> {
|
||||||
syncInformation.getRemote().getServer().setPush(b);
|
syncInformation.getRemote().getServer().setPush(b);
|
||||||
dataLocallyChanged = true;
|
syncInformation.setHasUnpublishedChanges(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
MaterialPreferenceSwitch allowPull = findViewById(R.id.switch_allow_pull);
|
MaterialPreferenceSwitch allowPull = findViewById(R.id.switch_allow_pull);
|
||||||
allowPull.setChecked(syncInformation.getRemote().getServer().getPull());
|
allowPull.setChecked(syncInformation.getRemote().getServer().getPull());
|
||||||
allowPull.setOnCheckedChangeListener((cb, b) -> {
|
allowPull.setOnCheckedChangeListener((cb, b) -> {
|
||||||
syncInformation.getRemote().getServer().setPull(b);
|
syncInformation.getRemote().getServer().setPull(b);
|
||||||
dataLocallyChanged = true;
|
syncInformation.setHasUnpublishedChanges(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
MaterialPreferenceSwitch allowCache = findViewById(R.id.switch_allow_cache);
|
MaterialPreferenceSwitch allowCache = findViewById(R.id.switch_allow_cache);
|
||||||
allowCache.setChecked(syncInformation.getRemote().getServer().getCachingEnabled());
|
allowCache.setChecked(syncInformation.getRemote().getServer().getCachingEnabled());
|
||||||
allowCache.setOnCheckedChangeListener((cb, b) -> {
|
allowCache.setOnCheckedChangeListener((cb, b) -> {
|
||||||
syncInformation.getRemote().getServer().setCachingEnabled(b);
|
syncInformation.getRemote().getServer().setCachingEnabled(b);
|
||||||
dataLocallyChanged = true;
|
syncInformation.setHasUnpublishedChanges(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// credentials
|
// credentials
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class UploadActivity extends AppCompatActivity {
|
||||||
server.setPull(syncInformation.getRemote().getServer().getPull());
|
server.setPull(syncInformation.getRemote().getServer().getPull());
|
||||||
server.setPush(syncInformation.getRemote().getServer().getPush());
|
server.setPush(syncInformation.getRemote().getServer().getPush());
|
||||||
server.setCachingEnabled(syncInformation.getRemote().getServer().getCachingEnabled());
|
server.setCachingEnabled(syncInformation.getRemote().getServer().getCachingEnabled());
|
||||||
server.setSelfSigned(syncInformation.getRemote().getServer().getCachingEnabled());
|
server.setSelfSigned(syncInformation.getRemote().getServer().getSelfSigned());
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,6 +259,7 @@ public class UploadActivity extends AppCompatActivity {
|
||||||
private void serverAdded(Server server) {
|
private void serverAdded(Server server) {
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
serverAction.done();
|
serverAction.done();
|
||||||
|
syncInformation.setHasUnpublishedChanges(false);
|
||||||
preferenceManager.addSyncInformation(syncInformation);
|
preferenceManager.addSyncInformation(syncInformation);
|
||||||
} else {
|
} else {
|
||||||
serverAction.error("Could not create Sync Server");
|
serverAction.error("Could not create Sync Server");
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class SyncInfoAdapter extends RecyclerView.Adapter<SyncInfoAdapter.ViewHo
|
||||||
|
|
||||||
holder.orgName.setText(item.getRemote().getOrganisation().getName());
|
holder.orgName.setText(item.getRemote().getOrganisation().getName());
|
||||||
|
|
||||||
if (item.isSyncedWithRemote()) {
|
if (item.getHasUnpublishedChanges()) {
|
||||||
ImageViewCompat.setImageTintList(holder.syncStatus, ColorStateList.valueOf(context.getColor(R.color.status_green)));
|
ImageViewCompat.setImageTintList(holder.syncStatus, ColorStateList.valueOf(context.getColor(R.color.status_green)));
|
||||||
holder.syncStatus.setImageResource(R.drawable.ic_check_outline);
|
holder.syncStatus.setImageResource(R.drawable.ic_check_outline);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class SyncInformation {
|
||||||
private ExchangeInformation remote;
|
private ExchangeInformation remote;
|
||||||
private ExchangeInformation local;
|
private ExchangeInformation local;
|
||||||
|
|
||||||
private boolean syncedWithRemote;
|
private boolean hasUnpublishedChanges;
|
||||||
|
|
||||||
|
|
||||||
public SyncInformation() {
|
public SyncInformation() {
|
||||||
|
@ -62,11 +62,11 @@ public class SyncInformation {
|
||||||
return df.format(date);
|
return df.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSyncedWithRemote(boolean syncedWithRemote) {
|
public void setHasUnpublishedChanges(boolean hasUnpublishedChanges) {
|
||||||
this.syncedWithRemote = syncedWithRemote;
|
this.hasUnpublishedChanges = hasUnpublishedChanges;
|
||||||
}
|
}
|
||||||
public boolean isSyncedWithRemote() {
|
public boolean getHasUnpublishedChanges() {
|
||||||
return syncedWithRemote;
|
return hasUnpublishedChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExchangeInformation getRemote() {
|
public ExchangeInformation getRemote() {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package lu.circl.mispbump.models.restModels;
|
package lu.circl.mispbump.models.restModels;
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
|
||||||
|
@ -302,4 +304,40 @@ public class Role {
|
||||||
public void setPermissionDescription(String permissionDescription) {
|
public void setPermissionDescription(String permissionDescription) {
|
||||||
this.permissionDescription = permissionDescription;
|
this.permissionDescription = permissionDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Role{" +
|
||||||
|
"id=" + id +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
", created='" + created + '\'' +
|
||||||
|
", modified='" + modified + '\'' +
|
||||||
|
", permAdd=" + permAdd +
|
||||||
|
", permModify=" + permModify +
|
||||||
|
", permModifyOrg=" + permModifyOrg +
|
||||||
|
", permPublish=" + permPublish +
|
||||||
|
", permDelegate=" + permDelegate +
|
||||||
|
", permSync=" + permSync +
|
||||||
|
", permAdmin=" + permAdmin +
|
||||||
|
", permAudit=" + permAudit +
|
||||||
|
", permAuth=" + permAuth +
|
||||||
|
", permSiteAdmin=" + permSiteAdmin +
|
||||||
|
", permRegexpAccess=" + permRegexpAccess +
|
||||||
|
", permTagger=" + permTagger +
|
||||||
|
", permTemplate=" + permTemplate +
|
||||||
|
", permSharingGroup=" + permSharingGroup +
|
||||||
|
", permTagEditor=" + permTagEditor +
|
||||||
|
", permSighting=" + permSighting +
|
||||||
|
", permObjectTemplate=" + permObjectTemplate +
|
||||||
|
", defaultRole=" + defaultRole +
|
||||||
|
", memoryLimit='" + memoryLimit + '\'' +
|
||||||
|
", maxExecutionTime='" + maxExecutionTime + '\'' +
|
||||||
|
", restrictedToSiteAdmin=" + restrictedToSiteAdmin +
|
||||||
|
", permPublishZmq=" + permPublishZmq +
|
||||||
|
", permPublishKafka=" + permPublishKafka +
|
||||||
|
", permission='" + permission + '\'' +
|
||||||
|
", permissionDescription='" + permissionDescription + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue