{ StmtType::EGetPrivilegeGroups, " SELECT group_name FROM privilege_group_view WHERE privilege_name = ?" },
{ StmtType::EGetUserApps, "SELECT name FROM app WHERE uid=?" },
{ StmtType::EGetAllTizen2XApps, "SELECT name FROM app WHERE version LIKE '2.%%' AND name <> ?" },
- { StmtType::EGetAllTizen2XPackages, "SELECT DISTINCT pkg_name FROM app_pkg_view WHERE version LIKE '2.%%' AND app_name <> ?" },
+ { StmtType::EGetAllTizen2XPackages, "SELECT DISTINCT pkg_name FROM app_pkg_view WHERE version LIKE '2.%%'" },
{ StmtType::EGetAppsInPkg, " SELECT app_name FROM app_pkg_view WHERE pkg_name = ?" },
{ StmtType::EGetGroups, "SELECT DISTINCT group_name FROM privilege_group_view" },
{ StmtType::EGetPkgAuthorId, "SELECT author_id FROM pkg WHERE name = ? AND author_id IS NOT NULL"},
void GetTizen2XApps(const std::string &origApp, std::vector<std::string> &apps);
/**
- * Retrieve list of all apps and packages excluding one specified (typically action originator)
+ * Retrieve list of all Tizen 2.X packages
*
- * @param origApp - do not include specific application name in the list
- * @param[out] apps - vector of app identifiers describing installed 2.x apps,
- * this parameter do not need to be empty, but
- * it is being overwritten during function call.
* @param[out] packages - vector of package identifiers describing installed 2.x packages,
* this parameter do not need to be empty, but
* it is being overwritten during function call.
* @exception DB::SqlConnection::Exception::InternalError on internal error
* @exception DB::SqlConnection::Exception::ConstraintError on constraint violation
*/
- void GetTizen2XAppsAndPackages(const std::string& origApp,
- std::vector<std::string> &apps, std::vector<std::string> &packages);
+ void GetTizen2XPackages(std::vector<std::string> &packages);
/* Retrive an id of an author from database
*
});
}
-void PrivilegeDb::GetTizen2XAppsAndPackages(const std::string& origApp,
- std::vector<std::string> &apps, std::vector<std::string> &packages)
+void PrivilegeDb::GetTizen2XPackages(std::vector<std::string> &packages)
{
try_catch<void>([&] {
- {
- auto command = getStatement(StmtType::EGetAllTizen2XApps);
- command->BindString(1, origApp);
- apps.clear();
- while (command->Step()) {
- const std::string & tizen2XApp = command->GetColumnString(0);
- LogDebug("Found " << tizen2XApp << " Tizen 2.X apps installed");
- apps.push_back(tizen2XApp);
- };
- }
- // grouping the packages below (can not use the statement above)
- {
- auto command = getStatement(StmtType::EGetAllTizen2XPackages);
- command->BindString(1, origApp);
- packages.clear();
- while (command->Step()) {
- const std::string & tizen2XPkg = command->GetColumnString(0);
- LogDebug("Found " << tizen2XPkg << " Tizen 2.X packages installed");
- packages.push_back(tizen2XPkg);
- };
- }
+ auto command = getStatement(StmtType::EGetAllTizen2XPackages);
+ packages.clear();
+ while (command->Step()) {
+ const std::string & tizen2XPkg = command->GetColumnString(0);
+ LogDebug("Found " << tizen2XPkg << " Tizen 2.X packages installed");
+ packages.push_back(tizen2XPkg);
+ };
});
}
CynaraAdmin::getInstance().UpdateAppPolicy(appLabel, cynaraUserStr, req.privileges);
// if app is targetted to Tizen 2.X, give other 2.X apps RO rules to it's shared dir
- if(isTizen2XVersion(req.tizenVersion))
- PrivilegeDb::getInstance().GetTizen2XAppsAndPackages(req.appName, allTizen2XApps, allTizen2XPackages);
+ if(isTizen2XVersion(req.tizenVersion)) {
+ PrivilegeDb::getInstance().GetTizen2XApps(req.appName, allTizen2XApps);
+ PrivilegeDb::getInstance().GetTizen2XPackages(allTizen2XPackages);
+ }
// WTF? Why this commit is here? Shouldn't it be at the end of this function?
PrivilegeDb::getInstance().CommitTransaction();