Fix unnecessary elevation confirmation

This commit is contained in:
crschnick 2024-03-25 10:51:33 +00:00
parent db94d2d74b
commit 6e5f131658
2 changed files with 34 additions and 1 deletions

View file

@ -42,7 +42,8 @@ public interface SecretQuery {
return r; return r;
} }
var ask = AppPrefs.get().alwaysConfirmElevation().getValue(); // Don't confirm if we already had user interaction
var ask = AppPrefs.get().alwaysConfirmElevation().getValue() && !original.requiresUserInteraction();
if (!ask) { if (!ask) {
return r; return r;
} }
@ -60,6 +61,11 @@ public interface SecretQuery {
public boolean retryOnFail() { public boolean retryOnFail() {
return true; return true;
} }
@Override
public boolean requiresUserInteraction() {
return original.requiresUserInteraction() || AppPrefs.get().alwaysConfirmElevation().getValue();
}
}; };
} }
@ -79,6 +85,11 @@ public interface SecretQuery {
public boolean retryOnFail() { public boolean retryOnFail() {
return true; return true;
} }
@Override
public boolean requiresUserInteraction() {
return true;
}
}; };
} }
@ -93,6 +104,8 @@ public interface SecretQuery {
boolean retryOnFail(); boolean retryOnFail();
boolean requiresUserInteraction();
default boolean respectDontCacheSetting() { default boolean respectDontCacheSetting() {
return true; return true;
} }

View file

@ -71,6 +71,11 @@ public interface SecretRetrievalStrategy {
public boolean retryOnFail() { public boolean retryOnFail() {
return false; return false;
} }
@Override
public boolean requiresUserInteraction() {
return false;
}
}; };
} }
} }
@ -95,6 +100,11 @@ public interface SecretRetrievalStrategy {
public boolean retryOnFail() { public boolean retryOnFail() {
return true; return true;
} }
@Override
public boolean requiresUserInteraction() {
return true;
}
}; };
} }
} }
@ -135,6 +145,11 @@ public interface SecretRetrievalStrategy {
public boolean retryOnFail() { public boolean retryOnFail() {
return false; return false;
} }
@Override
public boolean requiresUserInteraction() {
return false;
}
}; };
} }
} }
@ -170,6 +185,11 @@ public interface SecretRetrievalStrategy {
public boolean retryOnFail() { public boolean retryOnFail() {
return false; return false;
} }
@Override
public boolean requiresUserInteraction() {
return false;
}
}; };
} }
} }