mirror of https://github.com/MISP/misp-bump
ported to IntelliJ Idea
parent
3eb0d68750
commit
d3c25b8be9
|
@ -2,8 +2,9 @@ apply plugin: 'com.android.application'
|
|||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
buildToolsVersion "27.0.3"
|
||||
defaultConfig {
|
||||
applicationId "de.overview.wg.its.misp_authentificator"
|
||||
applicationId "de.overview.wg.its.mispauth"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 27
|
||||
versionCode 1
|
||||
|
@ -21,7 +22,7 @@ android {
|
|||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package de.overview.wg.its.misp_authentificator;
|
||||
package de.overview.wg.its.mispauth;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
|
@ -17,10 +17,10 @@ import static org.junit.Assert.*;
|
|||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("de.overview.wg.its.misp_authentificator", appContext.getPackageName());
|
||||
assertEquals("de.overview.wg.its.mispauth", appContext.getPackageName());
|
||||
}
|
||||
}
|
|
@ -1,33 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.overview.wg.its.misp_authentificator">
|
||||
package="de.overview.wg.its.mispauth">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".activity.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".activity.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<activity
|
||||
android:label="@string/title_activity_settings"
|
||||
android:name=".activity.SettingsActivity"
|
||||
android:parentActivityName=".activity.MainActivity" />
|
||||
<activity
|
||||
android:parentActivityName=".activity.MainActivity"
|
||||
android:name=".activity.SyncActivity"
|
||||
android:label="@string/title_activity_sync"
|
||||
android:theme="@style/AppTheme"/>
|
||||
</application>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activity.SettingsActivity"
|
||||
android:label="@string/title_activity_settings"
|
||||
android:parentActivityName=".activity.MainActivity"/>
|
||||
|
||||
<activity
|
||||
android:name=".activity.SyncActivity"
|
||||
android:label="@string/title_activity_sync"
|
||||
android:parentActivityName=".activity.MainActivity"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -1,54 +0,0 @@
|
|||
package de.overview.wg.its.misp_authentificator;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
public class PreferenceManager {
|
||||
|
||||
private static PreferenceManager instance;
|
||||
private Context context;
|
||||
private SharedPreferences sharedPreferences;
|
||||
|
||||
private String PREF_KEY_SERVER_URL;
|
||||
private String PREF_KEY_SERVER_API_KEY;
|
||||
|
||||
private PreferenceManager(Context context) {
|
||||
this.context = context;
|
||||
sharedPreferences = android.preference.PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
PREF_KEY_SERVER_URL = context.getResources().getString(R.string.key_server_url);
|
||||
PREF_KEY_SERVER_API_KEY = context.getResources().getString(R.string.key_server_api_key);
|
||||
}
|
||||
|
||||
public String getMyServerUrl() {
|
||||
return sharedPreferences.getString(PREF_KEY_SERVER_URL, "");
|
||||
}
|
||||
public void setMyServerUrl(String serverUrl) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(PREF_KEY_SERVER_URL, serverUrl);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public String getMyServerApiKey() {
|
||||
return sharedPreferences.getString(PREF_KEY_SERVER_API_KEY, "");
|
||||
}
|
||||
public void setMyServerApiKey(String apiKey) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(PREF_KEY_SERVER_API_KEY, apiKey);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void deleteAllLocalData() {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.clear();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static PreferenceManager Instance(Context context) {
|
||||
if(instance == null) {
|
||||
instance = new PreferenceManager(context);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package de.overview.wg.its.misp_authentificator.activity;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.glxn.qrgen.android.QRCode;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import de.overview.wg.its.misp_authentificator.R;
|
||||
|
||||
public class SyncActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sync);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
|
||||
generateMyQR();
|
||||
}
|
||||
|
||||
private void generateMyQR() {
|
||||
// ImageView qrImageView = findViewById(R.id.sync_my_qr);
|
||||
|
||||
Bitmap myBitmap = QRCode.from("This is my organisation information!")
|
||||
.withColor(0xFF000000, 0x00000000)
|
||||
.withSize(512,512)
|
||||
.bitmap();
|
||||
|
||||
// qrImageView.setImageBitmap(myBitmap);
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package de.overview.wg.its.misp_authentificator.adapter;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import de.overview.wg.its.misp_authentificator.R;
|
||||
|
||||
public class ExtOrgAdapter extends RecyclerView.Adapter<ExtOrgAdapter.ViewHolder> {
|
||||
|
||||
private String[] dataSet;
|
||||
|
||||
public ExtOrgAdapter(String[] dataSet) {
|
||||
this.dataSet = dataSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
||||
View extOrgView = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.view_holder_ext_org, parent, false);
|
||||
|
||||
return new ViewHolder(extOrgView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.orgTitle.setText(dataSet[position]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataSet.length;
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public TextView orgTitle;
|
||||
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
orgTitle = v.findViewById(R.id.ext_org_title);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
package de.overview.wg.its.misp_authentificator.activity;
|
||||
package de.overview.wg.its.mispauth.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.DividerItemDecoration;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
@ -11,47 +12,25 @@ import android.support.v7.widget.Toolbar;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import de.overview.wg.its.misp_authentificator.PreferenceManager;
|
||||
import de.overview.wg.its.misp_authentificator.R;
|
||||
import de.overview.wg.its.misp_authentificator.adapter.ExtOrgAdapter;
|
||||
import de.overview.wg.its.mispauth.R;
|
||||
import de.overview.wg.its.mispauth.adapter.ExtOrgAdapter;
|
||||
import de.overview.wg.its.mispauth.auxiliary.PreferenceManager;
|
||||
import de.overview.wg.its.mispauth.model.Organisation;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
PreferenceManager preferenceManager;
|
||||
private Organisation[] externalOrganisations;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
preferenceManager = PreferenceManager.Instance(this);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
RecyclerView orgRecyclerView = findViewById(R.id.orgRecyclerView);
|
||||
orgRecyclerView.setHasFixedSize(true);
|
||||
|
||||
RecyclerView.LayoutManager orgLayoutManager = new LinearLayoutManager(this);
|
||||
orgRecyclerView.setLayoutManager(orgLayoutManager);
|
||||
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(orgRecyclerView.getContext(), 1);
|
||||
orgRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
String[] dataSet = {};
|
||||
RecyclerView.Adapter orgAdapter = new ExtOrgAdapter(dataSet);
|
||||
orgRecyclerView.setAdapter(orgAdapter);
|
||||
|
||||
if(dataSet.length == 0){
|
||||
orgRecyclerView.setVisibility(View.GONE);
|
||||
findViewById(R.id.empty_view).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
orgRecyclerView.setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.empty_view).setVisibility(View.GONE);
|
||||
}
|
||||
getExternalOrganisations();
|
||||
setUpRecyclerView();
|
||||
|
||||
FloatingActionButton fabAdd = findViewById(R.id.fab_add);
|
||||
final FloatingActionButton fabSync = findViewById(R.id.fab_sync);
|
||||
|
@ -80,7 +59,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
@ -93,6 +71,47 @@ public class MainActivity extends AppCompatActivity {
|
|||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void setUpRecyclerView() {
|
||||
RecyclerView orgRecyclerView = findViewById(R.id.orgRecyclerView);
|
||||
orgRecyclerView.setHasFixedSize(true);
|
||||
|
||||
RecyclerView.LayoutManager orgLayoutManager = new LinearLayoutManager(this);
|
||||
orgRecyclerView.setLayoutManager(orgLayoutManager);
|
||||
|
||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(orgRecyclerView.getContext(), 1);
|
||||
orgRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||
|
||||
RecyclerView.Adapter orgAdapter = new ExtOrgAdapter(this, externalOrganisations);
|
||||
orgRecyclerView.setAdapter(orgAdapter);
|
||||
|
||||
if(externalOrganisations.length == 0){
|
||||
orgRecyclerView.setVisibility(View.GONE);
|
||||
findViewById(R.id.empty_view).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
orgRecyclerView.setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.empty_view).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
final SwipeRefreshLayout refreshLayout = findViewById(R.id.recycler_refresh);
|
||||
refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
// TODO do stuff
|
||||
// refreshLayout.setRefreshing(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getExternalOrganisations(){
|
||||
Organisation a = new Organisation();
|
||||
a.setName("Ferrari");
|
||||
a.setDescription("Ferrari has nothing to share");
|
||||
a.setSector("Fast cars");
|
||||
a.setNationality("Italy");
|
||||
a.setUserCount(67);
|
||||
|
||||
externalOrganisations = new Organisation[] {a};
|
||||
}
|
||||
|
||||
private void startSyncActivity(){
|
||||
startActivity(new Intent(this, SyncActivity.class));
|
|
@ -1,38 +1,40 @@
|
|||
package de.overview.wg.its.misp_authentificator.activity;
|
||||
package de.overview.wg.its.mispauth.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.android.volley.AuthFailureError;
|
||||
import com.android.volley.NoConnectionError;
|
||||
import android.widget.TextView;
|
||||
import com.android.volley.VolleyError;
|
||||
|
||||
import org.json.JSONException;
|
||||
import de.overview.wg.its.mispauth.R;
|
||||
import de.overview.wg.its.mispauth.auxiliary.PreferenceManager;
|
||||
import de.overview.wg.its.mispauth.auxiliary.ReadableError;
|
||||
import de.overview.wg.its.mispauth.model.Organisation;
|
||||
import de.overview.wg.its.mispauth.model.User;
|
||||
import de.overview.wg.its.mispauth.network.MispRequest;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import de.overview.wg.its.misp_authentificator.PreferenceManager;
|
||||
import de.overview.wg.its.misp_authentificator.R;
|
||||
import de.overview.wg.its.misp_authentificator.network.MispRequest;
|
||||
|
||||
public class SettingsActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "MISP-TAG";
|
||||
private static final String TAG = "DEBUG";
|
||||
|
||||
private PreferenceManager preferenceManager;
|
||||
private ProgressBar progressBar;
|
||||
private TextInputLayout serverUrlLayout, apiKeyLayout;
|
||||
private EditText serverUrlText, apiKeyText;
|
||||
|
||||
private Organisation org;
|
||||
private User user;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -48,18 +50,26 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
apiKeyLayout = findViewById(R.id.input_layout_api_key);
|
||||
serverUrlText = findViewById(R.id.edit_server_url);
|
||||
apiKeyText = findViewById(R.id.edit_api_key);
|
||||
|
||||
progressBar = findViewById(R.id.progressBar);
|
||||
|
||||
FloatingActionButton fabDlOrgInfo = findViewById(R.id.fab_download_own_org_info);
|
||||
|
||||
fabDlOrgInfo.setOnClickListener(new View.OnClickListener() {
|
||||
findViewById(R.id.fab_download_own_org_info).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
downloadMyOrgInfo();
|
||||
}
|
||||
});
|
||||
|
||||
apiKeyText.setOnKeyListener(new View.OnKeyListener() {
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (keyCode == 66) {
|
||||
hideKeyboard(v);
|
||||
apiKeyText.clearFocus();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
restoreSavedValues();
|
||||
}
|
||||
|
||||
|
@ -68,7 +78,6 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
getMenuInflater().inflate(R.menu.menu_settings, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
|
@ -83,15 +92,39 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void setOrganisation(Organisation org) {
|
||||
|
||||
if(org == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextView title = findViewById(R.id.organisation_title);
|
||||
TextView uuid = findViewById(R.id.organisation_uuid);
|
||||
TextView description = findViewById(R.id.organisation_description);
|
||||
TextView nationality = findViewById(R.id.organisation_nationality);
|
||||
TextView sector = findViewById(R.id.organisation_sector);
|
||||
TextView userCount = findViewById(R.id.organisation_user_count);
|
||||
|
||||
title.setText(org.getName());
|
||||
uuid.setText(org.getUuid());
|
||||
description.setText(org.getDescription());
|
||||
nationality.setText(org.getNationality());
|
||||
sector.setText(org.getSector());
|
||||
userCount.setText("" + org.getUserCount());
|
||||
}
|
||||
|
||||
private void restoreSavedValues() {
|
||||
preferenceManager = PreferenceManager.Instance(this);
|
||||
|
||||
serverUrlText.setText(preferenceManager.getMyServerUrl());
|
||||
apiKeyText.setText(preferenceManager.getMyServerApiKey());
|
||||
|
||||
setOrganisation(preferenceManager.getMyOrganisation());
|
||||
}
|
||||
|
||||
private void downloadMyOrgInfo(){
|
||||
user = new User();
|
||||
org = new Organisation();
|
||||
|
||||
boolean failed = false;
|
||||
|
||||
|
@ -110,70 +143,69 @@ public class SettingsActivity extends AppCompatActivity {
|
|||
|
||||
if(failed) {
|
||||
return;
|
||||
} else {
|
||||
serverUrlLayout.setError(null);
|
||||
apiKeyLayout.setError(null);
|
||||
}
|
||||
|
||||
final MispRequest request = MispRequest.Instance(this);
|
||||
|
||||
request.setServerCredentials(tmpServerUrl, tmpApiKey);
|
||||
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
request.myUserInformation(new MispRequest.UserInformationCallback() {
|
||||
|
||||
@Override
|
||||
public void onResult(JSONObject myUserInformation) {
|
||||
|
||||
int orgID;
|
||||
user.fromJSON(myUserInformation);
|
||||
preferenceManager.setMyUser(user);
|
||||
|
||||
try {
|
||||
orgID = myUserInformation.getInt("org_id");
|
||||
int orgID = user.getOrgId();
|
||||
|
||||
request.OrganisationInformation(orgID, new MispRequest.OrganisationInformationCallback() {
|
||||
@Override
|
||||
public void onResult(JSONObject organisationInformation) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
Log.i(TAG, "onResult: " + organisationInformation.toString());
|
||||
}
|
||||
request.OrganisationInformation(orgID, new MispRequest.OrganisationInformationCallback() {
|
||||
|
||||
@Override
|
||||
public void onError(VolleyError volleyError) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
Log.e(TAG, "onError: " + volleyError.toString());
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onResult(JSONObject organisationInformation) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
org.fromJSON(organisationInformation);
|
||||
|
||||
preferenceManager.setMyOrganisation(org);
|
||||
|
||||
setOrganisation(org);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(VolleyError volleyError) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
MakeSnackbar(ReadableError.toReadable(volleyError));
|
||||
Log.e(TAG, "onError: " + volleyError.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(VolleyError volleyError) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
if(volleyError instanceof NoConnectionError) {
|
||||
MakeAlert("No connection to server");
|
||||
} else if(volleyError instanceof AuthFailureError) {
|
||||
MakeAlert("Wrong API key");
|
||||
}
|
||||
MakeSnackbar(ReadableError.toReadable(volleyError));
|
||||
}
|
||||
});
|
||||
|
||||
// If auth was successful: save new credentials
|
||||
preferenceManager.setMyServerUrl(tmpServerUrl);
|
||||
preferenceManager.setMyServerApiKey(tmpApiKey);
|
||||
|
||||
}
|
||||
|
||||
private void MakeAlert(String msg){
|
||||
|
||||
private void MakeSnackbar(String msg){
|
||||
View contextView = findViewById(R.id.coordinator);
|
||||
|
||||
Snackbar.make(contextView, msg, Snackbar.LENGTH_LONG)
|
||||
.addCallback(new Snackbar.Callback(){
|
||||
@Override
|
||||
public void onShown(Snackbar sb) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
}).show();
|
||||
Snackbar.make(contextView, msg, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
private void hideKeyboard(View view) {
|
||||
InputMethodManager manager = (InputMethodManager) view.getContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||
if (manager != null) {
|
||||
manager.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package de.overview.wg.its.mispauth.activity;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import de.overview.wg.its.mispauth.R;
|
||||
|
||||
public class SyncActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sync);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package de.overview.wg.its.mispauth.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import de.overview.wg.its.mispauth.R;
|
||||
import de.overview.wg.its.mispauth.auxiliary.OrganisationDialog;
|
||||
import de.overview.wg.its.mispauth.model.Organisation;
|
||||
|
||||
public class ExtOrgAdapter extends RecyclerView.Adapter<ExtOrgAdapter.ViewHolder> {
|
||||
|
||||
private Context context;
|
||||
private Organisation[] dataSet;
|
||||
|
||||
public ExtOrgAdapter(Context context, Organisation[] dataSet) {
|
||||
this.context = context;
|
||||
this.dataSet = dataSet;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View extOrgView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_holder_ext_org, parent, false);
|
||||
return new ViewHolder(extOrgView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
|
||||
holder.orgTitle.setText(dataSet[position].getName());
|
||||
holder.subTitle.setText(dataSet[position].getDescription());
|
||||
|
||||
holder.parentLayout.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
OrganisationDialog d = new OrganisationDialog(context);
|
||||
d.createDialog(dataSet[position]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataSet.length;
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
RelativeLayout parentLayout;
|
||||
TextView orgTitle;
|
||||
TextView subTitle;
|
||||
|
||||
public ViewHolder(View v) {
|
||||
super(v);
|
||||
parentLayout = v.findViewById(R.id.parent_layout);
|
||||
orgTitle = v.findViewById(R.id.ext_org_title);
|
||||
subTitle = v.findViewById(R.id.ext_org_sub_title);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package de.overview.wg.its.mispauth.auxiliary;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import de.overview.wg.its.mispauth.R;
|
||||
import de.overview.wg.its.mispauth.model.Organisation;
|
||||
|
||||
public class OrganisationDialog {
|
||||
|
||||
private AlertDialog.Builder dialogBuilder;
|
||||
private LayoutInflater inflater;
|
||||
|
||||
public OrganisationDialog(Context context) {
|
||||
dialogBuilder = new AlertDialog.Builder(context);
|
||||
inflater = ((Activity)context).getLayoutInflater();
|
||||
}
|
||||
|
||||
public void createDialog(Organisation org) {
|
||||
|
||||
View dialogContent = inflater.inflate(R.layout.view_holder_organisation, null);
|
||||
dialogBuilder.setView(dialogContent);
|
||||
|
||||
TextView title = dialogContent.findViewById(R.id.organisation_title);
|
||||
title.setText(org.getName());
|
||||
|
||||
TextView description = dialogContent.findViewById(R.id.organisation_description);
|
||||
description.setText(org.getDescription());
|
||||
|
||||
TextView sector = dialogContent.findViewById(R.id.organisation_sector);
|
||||
sector.setText(org.getSector());
|
||||
|
||||
TextView nationality = dialogContent.findViewById(R.id.organisation_nationality);
|
||||
nationality.setText(org.getNationality());
|
||||
|
||||
TextView userCount = dialogContent.findViewById(R.id.organisation_user_count);
|
||||
userCount.setText("" + org.getUserCount());
|
||||
|
||||
dialogBuilder.setPositiveButton("OK", null);
|
||||
dialogBuilder.show();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package de.overview.wg.its.mispauth.auxiliary;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import de.overview.wg.its.mispauth.model.Organisation;
|
||||
import de.overview.wg.its.mispauth.model.User;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class PreferenceManager {
|
||||
|
||||
private static PreferenceManager instance;
|
||||
private SharedPreferences sharedPreferences;
|
||||
|
||||
private static String PREF_KEY_SERVER_URL = "key_server_url";
|
||||
private static String PREF_KEY_SERVER_API_KEY = "key_server_api_key";
|
||||
private static String PREF_KEY_MY_ORGANISATION = "key_my_organisation";
|
||||
private static String PREF_KEY_MY_USER = "key_my_user";
|
||||
|
||||
private PreferenceManager(Context context) {
|
||||
sharedPreferences = android.preference.PreferenceManager.getDefaultSharedPreferences(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return own Organisation if available, else null
|
||||
*/
|
||||
public Organisation getMyOrganisation() {
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(sharedPreferences.getString(PREF_KEY_MY_ORGANISATION, ""));
|
||||
Organisation org = new Organisation();
|
||||
org.fromJSON(jsonObject);
|
||||
return org;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public void setMyOrganisation(Organisation org) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(PREF_KEY_MY_ORGANISATION, org.toJSON().toString());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public User getMyUser() {
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(sharedPreferences.getString(PREF_KEY_MY_USER, ""));
|
||||
User user = new User();
|
||||
user.fromJSON(jsonObject);
|
||||
return user;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public void setMyUser(User user) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(PREF_KEY_MY_USER, user.toJSON().toString());
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public String getMyServerUrl() {
|
||||
return sharedPreferences.getString(PREF_KEY_SERVER_URL, "");
|
||||
}
|
||||
public void setMyServerUrl(String serverUrl) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(PREF_KEY_SERVER_URL, serverUrl);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public String getMyServerApiKey() {
|
||||
return sharedPreferences.getString(PREF_KEY_SERVER_API_KEY, "");
|
||||
}
|
||||
public void setMyServerApiKey(String apiKey) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString(PREF_KEY_SERVER_API_KEY, apiKey);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void deleteAllLocalData() {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.clear();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static PreferenceManager Instance(Context context) {
|
||||
if(instance == null) {
|
||||
instance = new PreferenceManager(context);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package de.overview.wg.its.mispauth.auxiliary;
|
||||
|
||||
import com.android.volley.AuthFailureError;
|
||||
import com.android.volley.NoConnectionError;
|
||||
import com.android.volley.VolleyError;
|
||||
|
||||
public class ReadableError {
|
||||
|
||||
public static String toReadable(VolleyError volleyError) {
|
||||
|
||||
if(volleyError instanceof NoConnectionError) {
|
||||
return "Connection failed";
|
||||
} else if(volleyError instanceof AuthFailureError) {
|
||||
return "Authentication failed";
|
||||
}
|
||||
|
||||
return "Unknown error";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,186 @@
|
|||
package de.overview.wg.its.mispauth.model;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class Organisation {
|
||||
|
||||
private static String ID_KEY = "id";
|
||||
private static String NAME_KEY = "name";
|
||||
private static String DATE_CREATED_KEY = "date_created";
|
||||
private static String DATE_MODIFIED_KEY = "date_modified";
|
||||
private static String TYPE_KEY = "type";
|
||||
private static String NATIONALITY_KEY = "nationality";
|
||||
private static String SECTOR_KEY = "sector";
|
||||
private static String CONTACTS_KEY = "contacts";
|
||||
private static String DESCRIPTION_KEY = "description";
|
||||
private static String LOCAL_KEY = "local";
|
||||
private static String UUID_KEY = "uuid";
|
||||
private static String RESTRICTED_TO_DOMAIN_KEY = "restricted_to_domain";
|
||||
private static String CREATED_BY_KEY = "created_by";
|
||||
private static String USER_COUNT_KEY = "user_count";
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private String dateCreated, dateModified;
|
||||
private String type;
|
||||
private String nationality;
|
||||
private String sector;
|
||||
private String contacts;
|
||||
private String description;
|
||||
private boolean local;
|
||||
private String uuid;
|
||||
private String restrictedToDomain;
|
||||
private int createdBy;
|
||||
private int userCount;
|
||||
|
||||
public Organisation() {}
|
||||
|
||||
public void fromJSON(JSONObject org) {
|
||||
|
||||
try {
|
||||
id = org.getInt(ID_KEY);
|
||||
dateCreated = org.getString(DATE_CREATED_KEY);
|
||||
dateModified = org.getString(DATE_MODIFIED_KEY);
|
||||
name = org.getString(NAME_KEY);
|
||||
type = org.getString(TYPE_KEY);
|
||||
nationality = org.getString(NATIONALITY_KEY);
|
||||
sector = org.getString(SECTOR_KEY);
|
||||
contacts = org.getString(CONTACTS_KEY);
|
||||
description = org.getString(DESCRIPTION_KEY);
|
||||
local = org.getBoolean(LOCAL_KEY);
|
||||
uuid = org.getString(UUID_KEY);
|
||||
restrictedToDomain = org.getString(RESTRICTED_TO_DOMAIN_KEY);
|
||||
createdBy = org.getInt(CREATED_BY_KEY);
|
||||
userCount = org.getInt(USER_COUNT_KEY);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject toJSON() {
|
||||
JSONObject org = new JSONObject();
|
||||
|
||||
try {
|
||||
org.put(ID_KEY, id);
|
||||
org.put(NAME_KEY, name);
|
||||
org.put(DATE_CREATED_KEY, dateCreated);
|
||||
org.put(DATE_MODIFIED_KEY, dateModified);
|
||||
org.put(TYPE_KEY, type);
|
||||
org.put(NATIONALITY_KEY, nationality);
|
||||
org.put(SECTOR_KEY, sector);
|
||||
org.put(CONTACTS_KEY, contacts);
|
||||
org.put(DESCRIPTION_KEY, description);
|
||||
org.put(LOCAL_KEY, local);
|
||||
org.put(UUID_KEY, uuid);
|
||||
org.put(RESTRICTED_TO_DOMAIN_KEY, restrictedToDomain);
|
||||
org.put(CREATED_BY_KEY, createdBy);
|
||||
org.put(USER_COUNT_KEY, userCount);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return org;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getSector() {
|
||||
return sector;
|
||||
}
|
||||
public void setSector(String sector) {
|
||||
this.sector = sector;
|
||||
}
|
||||
|
||||
public String getNationality() {
|
||||
return nationality;
|
||||
}
|
||||
public void setNationality(String nationality) {
|
||||
this.nationality = nationality;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDateCreated() {
|
||||
return dateCreated;
|
||||
}
|
||||
public void setDateCreated(String dateCreated) {
|
||||
this.dateCreated = dateCreated;
|
||||
}
|
||||
|
||||
public String getDateModified() {
|
||||
return dateModified;
|
||||
}
|
||||
public void setDateModified(String dateModified) {
|
||||
this.dateModified = dateModified;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getContacts() {
|
||||
return contacts;
|
||||
}
|
||||
public void setContacts(String contacts) {
|
||||
this.contacts = contacts;
|
||||
}
|
||||
|
||||
public boolean isLocal() {
|
||||
return local;
|
||||
}
|
||||
public void setLocal(boolean local) {
|
||||
this.local = local;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getRestrictedToDomain() {
|
||||
return restrictedToDomain;
|
||||
}
|
||||
public void setRestrictedToDomain(String restrictedToDomain) {
|
||||
this.restrictedToDomain = restrictedToDomain;
|
||||
}
|
||||
|
||||
public int getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
public void setCreatedBy(int createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public int getUserCount() {
|
||||
return userCount;
|
||||
}
|
||||
public void setUserCount(int userCount) {
|
||||
this.userCount = userCount;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,298 @@
|
|||
package de.overview.wg.its.mispauth.model;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class User {
|
||||
|
||||
private static String ID_KEY = "id";
|
||||
private static String PASSWORD_KEY = "password";
|
||||
private static String ORG_ID_KEY = "org_id";
|
||||
private static String EMAIL_KEY = "email";
|
||||
private static String AUTOALERT_KEY = "autoalert";
|
||||
private static String AUTHKEY_KEY = "authkey";
|
||||
private static String INVITED_BY_KEY = "invited_by";
|
||||
private static String GPGKEY_KEY = "gpgkey";
|
||||
private static String CERTIF_PUBLIC = "certif_public";
|
||||
private static String NIDS_SID = "nids_sid";
|
||||
private static String TERMS_ACCEPTED_KEY = "termsaccepted";
|
||||
private static String NEWSREAD_KEY = "newsread";
|
||||
private static String ROLE_ID_KEY = "role_id";
|
||||
private static String CHANGE_PW_KEY = "change_pw";
|
||||
private static String CONTACT_ALERT_KEY = "contactalert";
|
||||
private static String DISABLED_KEY = "disabled";
|
||||
private static String EXPIRATION_KEY = "expiration";
|
||||
private static String CURRENT_LOGIN_KEY = "current_login";
|
||||
private static String LAST_LOGIN_KEY = "last_login";
|
||||
private static String FORCE_LOGOUT_KEY = "force_logout";
|
||||
private static String DATE_CREATED_KEY = "date_created";
|
||||
private static String DATE_MODIFIED_KEY = "date_modified";
|
||||
|
||||
private int id;
|
||||
private String password;
|
||||
private int orgId;
|
||||
private String email;
|
||||
private boolean autoAlert;
|
||||
private String authkey;
|
||||
private int invitedBy;
|
||||
private String gpgKey;
|
||||
private String certifPublic;
|
||||
private int nidsSid;
|
||||
private boolean termsAccepted;
|
||||
private int newsRead; // Integer??
|
||||
private int roleId;
|
||||
private String changePw;
|
||||
private boolean contactAlert;
|
||||
private boolean disabled;
|
||||
private String expiration;
|
||||
private String currentLogin;
|
||||
private String lastLogin;
|
||||
private boolean forceLogout;
|
||||
private String dateCreated;
|
||||
private String dateModified;
|
||||
|
||||
public User() {}
|
||||
|
||||
public void fromJSON(JSONObject user) {
|
||||
try {
|
||||
|
||||
id = user.getInt(ID_KEY);
|
||||
password = user.getString(PASSWORD_KEY);
|
||||
orgId = user.getInt(ORG_ID_KEY);
|
||||
email = user.getString(EMAIL_KEY);
|
||||
autoAlert = user.getBoolean(AUTOALERT_KEY);
|
||||
authkey = user.getString(AUTHKEY_KEY);
|
||||
invitedBy = user.getInt(INVITED_BY_KEY);
|
||||
gpgKey = user.getString(GPGKEY_KEY);
|
||||
certifPublic = user.getString(CERTIF_PUBLIC);
|
||||
nidsSid = user.getInt(NIDS_SID);
|
||||
termsAccepted = user.getBoolean(TERMS_ACCEPTED_KEY);
|
||||
newsRead = user.getInt(NEWSREAD_KEY);
|
||||
roleId = user.getInt(ROLE_ID_KEY);
|
||||
changePw = user.getString(CHANGE_PW_KEY);
|
||||
contactAlert = user.getBoolean(CONTACT_ALERT_KEY);
|
||||
disabled = user.getBoolean(DISABLED_KEY);
|
||||
expiration = user.getString(EXPIRATION_KEY);
|
||||
currentLogin = user.getString(CURRENT_LOGIN_KEY);
|
||||
lastLogin = user.getString(LAST_LOGIN_KEY);
|
||||
forceLogout = user.getBoolean(FORCE_LOGOUT_KEY);
|
||||
dateCreated = user.getString(DATE_CREATED_KEY);
|
||||
dateModified = user.getString(DATE_MODIFIED_KEY);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public JSONObject toJSON() {
|
||||
JSONObject user = new JSONObject();
|
||||
|
||||
try {
|
||||
|
||||
user.put(ID_KEY, id);
|
||||
user.put(PASSWORD_KEY, password);
|
||||
user.put(ORG_ID_KEY, orgId);
|
||||
user.put(EMAIL_KEY, email);
|
||||
user.put(AUTOALERT_KEY, autoAlert);
|
||||
user.put(AUTHKEY_KEY, authkey);
|
||||
user.put(INVITED_BY_KEY, invitedBy);
|
||||
user.put(GPGKEY_KEY, gpgKey);
|
||||
user.put(CERTIF_PUBLIC, certifPublic);
|
||||
user.put(NIDS_SID, nidsSid);
|
||||
user.put(TERMS_ACCEPTED_KEY, termsAccepted);
|
||||
user.put(NEWSREAD_KEY, newsRead);
|
||||
user.put(ROLE_ID_KEY, roleId);
|
||||
user.put(CHANGE_PW_KEY, changePw);
|
||||
user.put(CONTACT_ALERT_KEY, contactAlert);
|
||||
user.put(DISABLED_KEY, disabled);
|
||||
user.put(EXPIRATION_KEY, expiration);
|
||||
user.put(CURRENT_LOGIN_KEY, currentLogin);
|
||||
user.put(LAST_LOGIN_KEY, lastLogin);
|
||||
user.put(FORCE_LOGOUT_KEY, forceLogout);
|
||||
user.put(DATE_CREATED_KEY, dateCreated);
|
||||
user.put(DATE_MODIFIED_KEY, dateModified);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public int getOrgId() {
|
||||
return orgId;
|
||||
}
|
||||
|
||||
public void setOrgId(int orgId) {
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public boolean isAutoAlert() {
|
||||
return autoAlert;
|
||||
}
|
||||
|
||||
public void setAutoAlert(boolean autoAlert) {
|
||||
this.autoAlert = autoAlert;
|
||||
}
|
||||
|
||||
public String getAuthkey() {
|
||||
return authkey;
|
||||
}
|
||||
|
||||
public void setAuthkey(String authkey) {
|
||||
this.authkey = authkey;
|
||||
}
|
||||
|
||||
public int getInvitedBy() {
|
||||
return invitedBy;
|
||||
}
|
||||
|
||||
public void setInvitedBy(int invitedBy) {
|
||||
this.invitedBy = invitedBy;
|
||||
}
|
||||
|
||||
public String getGpgKey() {
|
||||
return gpgKey;
|
||||
}
|
||||
|
||||
public void setGpgKey(String gpgKey) {
|
||||
this.gpgKey = gpgKey;
|
||||
}
|
||||
|
||||
public String getCertifPublic() {
|
||||
return certifPublic;
|
||||
}
|
||||
|
||||
public void setCertifPublic(String certifPublic) {
|
||||
this.certifPublic = certifPublic;
|
||||
}
|
||||
|
||||
public int getNidsSid() {
|
||||
return nidsSid;
|
||||
}
|
||||
|
||||
public void setNidsSid(int nidsSid) {
|
||||
this.nidsSid = nidsSid;
|
||||
}
|
||||
|
||||
public boolean isTermsAccepted() {
|
||||
return termsAccepted;
|
||||
}
|
||||
|
||||
public void setTermsAccepted(boolean termsAccepted) {
|
||||
this.termsAccepted = termsAccepted;
|
||||
}
|
||||
|
||||
public int getNewsRead() {
|
||||
return newsRead;
|
||||
}
|
||||
|
||||
public void setNewsRead(int newsRead) {
|
||||
this.newsRead = newsRead;
|
||||
}
|
||||
|
||||
public int getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(int roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getChangePw() {
|
||||
return changePw;
|
||||
}
|
||||
|
||||
public void setChangePw(String changePw) {
|
||||
this.changePw = changePw;
|
||||
}
|
||||
|
||||
public boolean isContactAlert() {
|
||||
return contactAlert;
|
||||
}
|
||||
|
||||
public void setContactAlert(boolean contactAlert) {
|
||||
this.contactAlert = contactAlert;
|
||||
}
|
||||
|
||||
public boolean isDisabled() {
|
||||
return disabled;
|
||||
}
|
||||
|
||||
public void setDisabled(boolean disabled) {
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
public String getExpiration() {
|
||||
return expiration;
|
||||
}
|
||||
|
||||
public void setExpiration(String expiration) {
|
||||
this.expiration = expiration;
|
||||
}
|
||||
|
||||
public String getCurrentLogin() {
|
||||
return currentLogin;
|
||||
}
|
||||
|
||||
public void setCurrentLogin(String currentLogin) {
|
||||
this.currentLogin = currentLogin;
|
||||
}
|
||||
|
||||
public String getLastLogin() {
|
||||
return lastLogin;
|
||||
}
|
||||
|
||||
public void setLastLogin(String lastLogin) {
|
||||
this.lastLogin = lastLogin;
|
||||
}
|
||||
|
||||
public boolean isForceLogout() {
|
||||
return forceLogout;
|
||||
}
|
||||
|
||||
public void setForceLogout(boolean forceLogout) {
|
||||
this.forceLogout = forceLogout;
|
||||
}
|
||||
|
||||
public String getDateCreated() {
|
||||
return dateCreated;
|
||||
}
|
||||
|
||||
public void setDateCreated(String dateCreated) {
|
||||
this.dateCreated = dateCreated;
|
||||
}
|
||||
|
||||
public String getDateModified() {
|
||||
return dateModified;
|
||||
}
|
||||
|
||||
public void setDateModified(String dateModified) {
|
||||
this.dateModified = dateModified;
|
||||
}
|
||||
}
|
|
@ -1,24 +1,21 @@
|
|||
package de.overview.wg.its.misp_authentificator.network;
|
||||
package de.overview.wg.its.mispauth.network;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.volley.Request;
|
||||
import com.android.volley.RequestQueue;
|
||||
import com.android.volley.Response;
|
||||
import com.android.volley.VolleyError;
|
||||
import com.android.volley.toolbox.JsonObjectRequest;
|
||||
import com.android.volley.toolbox.Volley;
|
||||
|
||||
import de.overview.wg.its.mispauth.auxiliary.PreferenceManager;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import de.overview.wg.its.misp_authentificator.PreferenceManager;
|
||||
|
||||
/**
|
||||
* Simple JSON based API to communicate with MISP-Instances
|
||||
*/
|
||||
|
@ -33,7 +30,6 @@ public class MispRequest {
|
|||
private String serverUrl, apiKey;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param context for Volley and PreferenceManager
|
||||
*/
|
||||
private MispRequest(Context context) {
|
||||
|
@ -42,7 +38,6 @@ public class MispRequest {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param orgId organisation ID on the MISP-Instance
|
||||
* @param callback returns a single Organisation-JSON
|
||||
*/
|
|
@ -1,81 +1,92 @@
|
|||
<android.support.design.widget.CoordinatorLayout
|
||||
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
tools:context=".activity.SettingsActivity"
|
||||
android:background="@color/colorPrimary">
|
||||
tools:context=".activity.SettingsActivity"
|
||||
android:background="@color/colorPrimary">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/settings.appbar"
|
||||
app:elevation="0dp"
|
||||
android:background="@color/colorPrimaryDark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
android:id="@+id/settings.appbar"
|
||||
app:elevation="0dp"
|
||||
android:background="@color/colorPrimaryDark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:backgroundTint="@color/colorPrimary"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
android:padding="16dp"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/orgRecyclerView"
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/empty_ext_org_dataset"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:id="@+id/empty_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/empty_ext_org_dataset"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/recycler_refresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/orgRecyclerView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:fabSize="normal"
|
||||
app:layout_anchor="@+id/constraintLayout"
|
||||
app:layout_anchorGravity="right|bottom"
|
||||
app:srcCompat="@drawable/ic_add_white" />
|
||||
android:id="@+id/fab_add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:fabSize="normal"
|
||||
app:layout_anchor="@+id/constraintLayout"
|
||||
app:layout_anchorGravity="right|bottom"
|
||||
app:srcCompat="@drawable/ic_add_white"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab_sync"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:visibility="gone"
|
||||
app:fabSize="mini"
|
||||
app:layout_anchor="@+id/fab_add"
|
||||
app:layout_anchorGravity="top|center_horizontal"
|
||||
app:srcCompat="@drawable/ic_sync_white" />
|
||||
android:id="@+id/fab_sync"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:visibility="gone"
|
||||
app:fabSize="mini"
|
||||
app:layout_anchor="@+id/fab_add"
|
||||
app:layout_anchorGravity="top|center_horizontal"
|
||||
app:srcCompat="@drawable/ic_sync_white"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
|
@ -77,7 +77,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background_rounded_main"
|
||||
android:padding="16dp"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<ProgressBar
|
||||
|
@ -91,101 +90,12 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/organisation_title"
|
||||
android:layout_width="309dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="My Organisation Title"
|
||||
android:textAlignment="center"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="15360ef8-68ba-11e8-adc0-fa7ae01bbebc"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/organisation_title" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:tint="@color/colorPrimary"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView"
|
||||
app:srcCompat="@drawable/ic_edit_white_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="Sample description of my organisation. This is imported directly from your MISP server."
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView2"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:tint="@color/colorPrimary"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2"
|
||||
app:srcCompat="@drawable/ic_flag_white_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Bonn, Germany"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView3"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView2" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:tint="@color/colorPrimary"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView3"
|
||||
app:srcCompat="@drawable/ic_sector" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="Software development"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView4"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView3" />
|
||||
<include layout="@layout/view_holder_organisation"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="0dp" android:layout_height="0dp" android:id="@+id/include"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
|
|
@ -1,33 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ext_org_title"
|
||||
android:layout_marginEnd="40dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/parent_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="Title"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"/>
|
||||
android:padding="16dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ext_org_sub_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/ext_org_title"
|
||||
android:text="http://192.168.178.200"
|
||||
android:textSize="15sp"/>
|
||||
android:id="@+id/ext_org_title"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="Title"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_info_white"
|
||||
android:tint="@color/colorPrimary"
|
||||
android:layout_alignParentEnd="true" />
|
||||
<TextView
|
||||
android:id="@+id/ext_org_sub_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/ext_org_title"
|
||||
android:text="Short description describing the description ..."
|
||||
android:textSize="15sp"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.LinearLayoutCompat
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/organisation_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:text="Title"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/organisation_uuid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:textStyle="italic"
|
||||
android:text="uuid"/>
|
||||
|
||||
<GridLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:rowCount="5"
|
||||
android:columnCount="2">
|
||||
|
||||
<TextView
|
||||
android:paddingTop="32dp"
|
||||
android:text="Description"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:id="@+id/organisation_description"
|
||||
android:text="Description"/>
|
||||
|
||||
<TextView
|
||||
android:paddingTop="16dp"
|
||||
android:text="Nationality"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:id="@+id/organisation_nationality"
|
||||
android:text="Germany"/>
|
||||
|
||||
<TextView
|
||||
android:paddingTop="16dp"
|
||||
android:text="Sector"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:id="@+id/organisation_sector"
|
||||
android:text="Software"/>
|
||||
|
||||
<TextView
|
||||
android:paddingTop="16dp"
|
||||
android:text="Users"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dip"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:id="@+id/organisation_user_count"
|
||||
android:text="0"/>
|
||||
|
||||
</GridLayout>
|
||||
|
||||
</android.support.v7.widget.LinearLayoutCompat>
|
||||
|
|
@ -1,19 +1,14 @@
|
|||
<resources>
|
||||
<string name="app_name">MISPauth</string>
|
||||
<string name="app_name">MISPauth</string>
|
||||
|
||||
<string name="empty_ext_org_dataset">No External Organisations available</string>
|
||||
<string name="empty_local_org_dataset">No Local Information Available</string>
|
||||
<string name="empty_ext_org_dataset">No External Organisations available</string>
|
||||
<string name="empty_local_org_dataset">No Local Information Available</string>
|
||||
|
||||
// Settings
|
||||
// Settings
|
||||
|
||||
<string name="settings_server_url">Server URL</string>
|
||||
<string name="settings_api_key">API Key</string>
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
<string name="title_activity_sync">Synchronise</string>
|
||||
|
||||
// Preferences
|
||||
|
||||
<string name="key_server_url">key_server_url</string>
|
||||
<string name="key_server_api_key">key_server_api_key</string>
|
||||
<string name="settings_server_url">Server URL</string>
|
||||
<string name="settings_api_key">API Key</string>
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
<string name="title_activity_sync">Synchronise</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package de.overview.wg.its.misp_authentificator;
|
||||
package de.overview.wg.its.mispauth;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -11,7 +11,7 @@ import static org.junit.Assert.*;
|
|||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
#Tue May 22 17:01:34 CEST 2018
|
||||
#Thu Jun 07 17:33:27 CEST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
|
@ -6,6 +6,42 @@
|
|||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
|
@ -24,46 +60,6 @@ cd "`dirname \"$PRG\"`/" >/dev/null
|
|||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
|
@ -89,7 +85,7 @@ location of your Java installation."
|
|||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
|
@ -154,19 +150,11 @@ if $cygwin ; then
|
|||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
|
@ -46,9 +46,10 @@ echo location of your Java installation.
|
|||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
|
@ -59,6 +60,11 @@ set _SKIP=2
|
|||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
|
Loading…
Reference in New Issue