Add the access string to the app access request dialog.

This way the user can see what operation the application tries to do.
This commit is contained in:
Michael Lotz
2013-03-05 11:04:48 -05:00
committed by Ryan Leavengood
parent cbdd5aff17
commit a59169de6f
4 changed files with 26 additions and 13 deletions
@@ -31,7 +31,8 @@ static const uint32 kMessageAlways = 'btaa';
class AppAccessRequestView : public BView {
public:
AppAccessRequestView(const char* keyringName, const char* signature,
const char* path, bool appIsNew, bool appWasUpdated)
const char* path, const char* accessString, bool appIsNew,
bool appWasUpdated)
:
BView("AppAccessRequestView", B_WILL_DRAW)
{
@@ -52,10 +53,18 @@ public:
return;
BString details;
details << "The application:\n\n"
<< signature << " (" << path << ")\n\n"
<< "requests access to keyring:\n\n"
<< keyringName << "\n\n";
details << "The application:\n"
<< signature << " (" << path << ")\n\n";
if (keyringName != NULL) {
details << "requests access to keyring:\n"
<< keyringName << "\n\n";
}
if (accessString != NULL) {
details << "to perform the following action:\n"
<< accessString << "\n\n";
}
if (appIsNew)
details << "This application hasn't been granted access before.";
@@ -120,7 +129,8 @@ private:
AppAccessRequestWindow::AppAccessRequestWindow(const char* keyringName,
const char* signature, const char* path, bool appIsNew, bool appWasUpdated)
const char* signature, const char* path, const char* accessString,
bool appIsNew, bool appWasUpdated)
:
BWindow(BRect(50, 50, 269, 302), "Application Keyring Access",
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS
@@ -140,7 +150,7 @@ AppAccessRequestWindow::AppAccessRequestWindow(const char* keyringName,
SetLayout(layout);
fRequestView = new(std::nothrow) AppAccessRequestView(keyringName,
signature, path, appIsNew, appWasUpdated);
signature, path, accessString, appIsNew, appWasUpdated);
if (fRequestView == NULL)
return;
@@ -18,7 +18,8 @@ public:
AppAccessRequestWindow(
const char* keyringName,
const char* signature,
const char* path, bool appIsNew,
const char* path,
const char* accessString, bool appIsNew,
bool appWasUpdated);
virtual ~AppAccessRequestWindow();
+5 -4
View File
@@ -635,9 +635,10 @@ KeyStoreServer::_ValidateAppAccess(Keyring& keyring, const app_info& appInfo,
if ((accessFlags & appFlags) == accessFlags)
return B_OK;
const char* accessString = _AccessStringFor(accessFlags);
bool allowAlways = false;
result = _RequestAppAccess(keyring.Name(), appInfo.signature, path.Path(),
appIsNew, appWasUpdated, accessFlags, allowAlways);
accessString, appIsNew, appWasUpdated, accessFlags, allowAlways);
if (result != B_OK || !allowAlways)
return result;
@@ -656,12 +657,12 @@ KeyStoreServer::_ValidateAppAccess(Keyring& keyring, const app_info& appInfo,
status_t
KeyStoreServer::_RequestAppAccess(const BString& keyringName,
const char* signature, const char* path, bool appIsNew, bool appWasUpdated,
uint32 accessFlags, bool& allowAlways)
const char* signature, const char* path, const char* accessString,
bool appIsNew, bool appWasUpdated, uint32 accessFlags, bool& allowAlways)
{
AppAccessRequestWindow* requestWindow
= new(std::nothrow) AppAccessRequestWindow(keyringName, signature, path,
appIsNew, appWasUpdated);
accessString, appIsNew, appWasUpdated);
if (requestWindow == NULL)
return B_NO_MEMORY;
+2 -1
View File
@@ -40,7 +40,8 @@ private:
status_t _RequestAppAccess(
const BString& keyringName,
const char* signature,
const char* path, bool appIsNew,
const char* path,
const char* accessString, bool appIsNew,
bool appWasUpdated, uint32 accessFlags,
bool& allowAlways);