sPFFramework/src/main/java/it/polimi/spf/framework/security/PersonPermissionTable.java
public PersonAuth getPersonAuthFrom(String receivedTkn) {
		if (receivedTkn.equals("")) {
			return PersonAuth.getPublicAuth();
		}

		String selection = RelationshipEntry.COLUMN_TKN + " = ? AND " + RelationshipEntry.COLUMN_REQUEST_STATUS + " = ?";
		String[] selectionArgs = { receivedTkn, Integer.toString(REQUEST_ACCEPTED) };
		String[] columns = { RelationshipEntry.COLUMN_USER_UUID };
		SQLiteDatabase db = getReadableDatabase();
		Cursor cursor = db.query(RelationshipEntry.TABLE_PERSON_AUTH, columns, selection, selectionArgs, /* groupBy */null, /* having */null, /* orderBy */
				null);

		PersonAuth auth;
		if (cursor.moveToNext()) {
			String uniqueIdentifier = cursor.getString(cursor.getColumnIndex(RelationshipEntry.COLUMN_USER_UUID));
			auth = generatePermissionFor(uniqueIdentifier, db);
		} else {
			auth = PersonAuth.getPublicAuth();
		}

		cursor.close();
		return auth;
	}
public PersonAuth getPersonAuthFrom(String receivedTkn) {
		if (receivedTkn.equals("")) {
			return PersonAuth.getPublicAuth();
		}

		String selection = RelationshipEntry.COLUMN_TKN + " = ? AND " + RelationshipEntry.COLUMN_REQUEST_STATUS + " = ?";
		String[] selectionArgs = { receivedTkn, Integer.toString(REQUEST_ACCEPTED) };
		String[] columns = { RelationshipEntry.COLUMN_USER_UUID };
		SQLiteDatabase db = getReadableDatabase();
		Cursor cursor = db.query(RelationshipEntry.TABLE_PERSON_AUTH, columns, selection, selectionArgs, /* groupBy */null, /* having */null, /* orderBy */
				null);

		PersonAuth auth;
		if (cursor.moveToNext()) {
			String uniqueIdentifier = cursor.getString(cursor.getColumnIndex(RelationshipEntry.COLUMN_USER_UUID));
			auth = generatePermissionFor(uniqueIdentifier, db);
		} else {
			auth = PersonAuth.getPublicAuth();
		}

		cursor.close();
		return auth;
	}
public PersonAuth getPersonAuthFrom ( String receivedTkn ) { if ( receivedTkn . equals ( "" ) ) { return PersonAuth . getPublicAuth ( ) ; } String selection = RelationshipEntry . COLUMN_TKN + " = ? AND " + RelationshipEntry . COLUMN_REQUEST_STATUS + " = ?" ; String [ ] selectionArgs = { receivedTkn , Integer . toString ( REQUEST_ACCEPTED ) } ; String [ ] columns = { RelationshipEntry . COLUMN_USER_UUID } ; SQLiteDatabase db = getReadableDatabase ( ) ; Cursor cursor = db . query ( RelationshipEntry . TABLE_PERSON_AUTH , columns , selection , selectionArgs , /* groupBy */ null , /* having */ null , /* orderBy */ null ) ; PersonAuth auth ; if ( cursor . moveToNext ( ) ) { String uniqueIdentifier = cursor . getString ( cursor . getColumnIndex ( RelationshipEntry . COLUMN_USER_UUID ) ) ; auth = generatePermissionFor ( uniqueIdentifier , db ) ; } else { auth = PersonAuth . getPublicAuth ( ) ; } cursor . close ( ) ; return auth ; }
Call this method every time you receive a remote request.

@param receivedTkn
- may be null
@return
Call this method every time you receive a remote request .