Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [247539/cifs] cannot create mount dir in v23 #1879

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions src/plugins/daemon/daemonplugin-accesscontrol/accesscontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@
#include <sys/types.h>
#include <sys/stat.h>

#ifdef COMPILE_ON_V23
# define ACCOUNTS_BUS_NAME "org.deepin.dde.Accounts1"
# define ACCOUNTS_OBJ_PATH "/org/deepin/dde/Accounts1"
# define ACCOUNTS_INTERFACE "org.deepin.dde.Accounts1"
# define ACCOUNTS_USER_INTERFACE "org.deepin.dde.Accounts1.User"
#else
# define ACCOUNTS_BUS_NAME "com.deepin.daemon.Accounts"
# define ACCOUNTS_OBJ_PATH "/com/deepin/daemon/Accounts"
# define ACCOUNTS_INTERFACE "com.deepin.daemon.Accounts"
# define ACCOUNTS_USER_INTERFACE "com.deepin.daemon.Accounts.User"
#endif

namespace daemonplugin_accesscontrol {

DFM_LOG_REISGER_CATEGORY(DAEMONPAC_NAMESPACE)
Expand Down Expand Up @@ -49,22 +61,22 @@ void AccessControl::initDBusInterce()

void AccessControl::initConnect()
{
QDBusConnection::systemBus().connect("com.deepin.daemon.Accounts",
"/com/deepin/daemon/Accounts",
"com.deepin.daemon.Accounts",
QDBusConnection::systemBus().connect(ACCOUNTS_BUS_NAME,
ACCOUNTS_OBJ_PATH,
ACCOUNTS_INTERFACE,
"UserAdded",
this,
SLOT(createUserMountDir(const QString &)));
}

void AccessControl::createUserMountDir(const QString &objPath)
{
QDBusInterface userIface("com.deepin.daemon.Accounts",
QDBusInterface userIface(ACCOUNTS_BUS_NAME,
objPath,
"com.deepin.daemon.Accounts.User",
ACCOUNTS_USER_INTERFACE,
QDBusConnection::systemBus());
const QString &userName = userIface.property("UserName").toString();
fmInfo() << "about to create mount dir of user" << userName;
fmInfo() << "about to create mount dir of user" << userName << objPath;

const QString &userMountRoot = QString("/media/%1").arg(userName);
if (!QDir(userMountRoot).exists()) {
Expand All @@ -85,9 +97,9 @@ void AccessControl::createUserMountDir(const QString &objPath)
void AccessControl::createUserMountDirs()
{
// get user list by com.deepin.daemon.Accounts
QDBusInterface iface("com.deepin.daemon.Accounts",
"/com/deepin/daemon/Accounts",
"com.deepin.daemon.Accounts",
QDBusInterface iface(ACCOUNTS_BUS_NAME,
ACCOUNTS_OBJ_PATH,
ACCOUNTS_INTERFACE,
QDBusConnection::systemBus());
QStringList userNames;
const QStringList &userList = iface.property("UserList").toStringList();
Expand Down
Loading