Skip to content

Commit

Permalink
wip.| #1203
Browse files Browse the repository at this point in the history
  • Loading branch information
DenBond7 committed Aug 5, 2021
1 parent a327a09 commit 9f1b659
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,25 @@ data class OrgRules constructor(
* public keys for these domains, such as from their own internal keyserver
*/
fun canLookupThisRecipientOnAttester(emailAddr: String): Boolean {
val domain = EmailUtil.getDomain(emailAddr)
val domains = disallowAttesterSearchForDomains ?: emptyList()
return !domains.contains(if (domain.isEmpty()) "NONE" else domain)
if (disallowLookupOnAttester()) {
return false
}

val disallowedDomains = disallowAttesterSearchForDomains ?: emptyList()
val userDomain = EmailUtil.getDomain(emailAddr)
if (userDomain.isEmpty()) {
throw IllegalStateException("Not a valid email $emailAddr")
}

return !disallowedDomains.contains(userDomain)
}

/**
*
* Some orgs might want to disallow lookup on attester completely
*/
fun disallowLookupOnAttester(): Boolean {
return (disallowAttesterSearchForDomains ?: emptyList()).contains("*")
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,11 @@ class ContactsViewModel(application: Application) : AccountViewModel(application
private suspend fun getPgpContactInfoFromServer(
email: String? = null,
fingerprint: String? = null
):
PgpContact? =
): PgpContact? =
withContext(Dispatchers.IO) {
try {
val activeAccount = getActiveAccountSuspend()

val response = apiRepository.getPub(
context = getApplication(),
identData = email ?: fingerprint ?: ""
Expand Down

0 comments on commit 9f1b659

Please sign in to comment.