Merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-ui-01 into lp:ubuntu-filemanager-app

Proposed by Carlos Jose Mazieri on 2015-09-07
Status: Merged
Approved by: Arto Jalkanen on 2015-09-13
Approved revision: 459
Merged at revision: 464
Proposed branch: lp:~carlos-mazieri/ubuntu-filemanager-app/samba-ui-01
Merge into: lp:ubuntu-filemanager-app
Diff against target: 96 lines (+35/-12)
2 files modified
src/plugin/folderlistmodel/dirmodel.cpp (+34/-11)
src/plugin/folderlistmodel/dirmodel.h (+1/-1)
To merge this branch: bzr merge lp:~carlos-mazieri/ubuntu-filemanager-app/samba-ui-01
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-09-12
Arto Jalkanen 2015-09-07 Needs Fixing on 2015-09-08
Review via email: mp+270334@code.launchpad.net

Commit message

Improved "unlock full access" regarding remote locations

Description of the change

This is the first MP of a series of 5.

That set of MP contains changes in places, icons and provides a dialog to authenticate remote locations when they require authentication to access its data.

link to click package in case of testing (install libsmbclient first):
   https://www.dropbox.com/s/f6gxiqbav3th8bx/com.ubuntu.filemanager_0.4.latest_armhf.click?dl=0

Other links:
   https://www.dropbox.com/s/gmaiadmr42ph2dj/screenshot_authentication.png?dl=0
   https://www.dropbox.com/s/wdstwscvs1wh9tx/screenshot_browsin_hosts.png?dl=0

To post a comment you must log in.
review: Approve (continuous-integration)
Arto Jalkanen (ajalkane) :
review: Needs Fixing
459. By Carlos Jose Mazieri on 2015-09-12

Replaced DirModel::allowAccess(const QString&) by DirModel::allowCurrentPathAccess()

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/plugin/folderlistmodel/dirmodel.cpp'
2--- src/plugin/folderlistmodel/dirmodel.cpp 2015-08-25 18:41:31 +0000
3+++ src/plugin/folderlistmodel/dirmodel.cpp 2015-09-12 17:21:40 +0000
4@@ -542,12 +542,30 @@
5 }
6
7 bool DirModel::allowAccess(const DirItemInfo &fi) const {
8- return allowAccess(fi.absoluteFilePath());
9-}
10-
11-bool DirModel::allowAccess(const QString &absoluteFilePath) const {
12- return !mOnlyAllowedPaths || isAllowedPath(absoluteFilePath);
13-}
14+ bool allowed = !mOnlyAllowedPaths; // !mOnlyAllowedPaths means any path is allowed
15+ if (!allowed)
16+ {
17+ allowed = fi.isRemote() ? !fi.needsAuthentication() : //remote locations
18+ isAllowedPath(fi.absoluteFilePath());//local disk locations
19+ }
20+ return allowed;
21+}
22+
23+/*!
24+ * \brief DirModel::allowCurrentPathAccess() Checks the access in the current path \a mCurrentDir
25+ *
26+ * As \a mCurrentDir comes from mCurLocation->info()->urlPath() allowAccess(const DirItemInfo &fi) can be used here
27+ *
28+ * \sa setPathFromCurrentLocation()
29+ *
30+ * \return
31+ */
32+bool DirModel::allowCurrentPathAccess() const {
33+ const DirItemInfo *currentDirInfo = mCurLocation->info();
34+ Q_ASSERT(currentDirInfo);
35+ return allowAccess(*currentDirInfo);
36+}
37+
38
39 void DirModel::onItemsAdded(const DirItemInfoList &newFiles)
40 {
41@@ -581,7 +599,7 @@
42
43 void DirModel::rm(const QStringList &paths)
44 {
45- if (!allowAccess(mCurrentDir)) {
46+ if (!allowCurrentPathAccess()) {
47 qDebug() << Q_FUNC_INFO << "Access denied in current path" << mCurrentDir;
48 return;
49 }
50@@ -617,9 +635,14 @@
51 return false;
52 }
53
54+ if (!allowCurrentPathAccess()) {
55+ qDebug() << Q_FUNC_INFO << "Access denied in current path" << mCurrentDir;
56+ return false;
57+ }
58+
59 const DirItemInfo &fi = mDirectoryContents.at(row);
60- if (!allowAccess(mCurrentDir)) {
61- qDebug() << Q_FUNC_INFO << "Access denied in current path" << mCurrentDir;
62+ if (!allowAccess(fi)) {
63+ qDebug() << Q_FUNC_INFO << "Access denied in" << fi.absoluteFilePath();
64 return false;
65 }
66
67@@ -871,7 +894,7 @@
68
69 void DirModel::cutPaths(const QStringList &items)
70 {
71- if (!allowAccess(mCurrentDir)) {
72+ if (!allowCurrentPathAccess()) {
73 qDebug() << Q_FUNC_INFO << "Access denied in current path" << mCurrentDir;
74 return;
75 }
76@@ -883,7 +906,7 @@
77 void DirModel::paste()
78 {
79 // Restrict pasting if in restricted directory when pasting on a local file system
80- if (!mCurLocation->isRemote() && !allowAccess(mCurrentDir)) {
81+ if (!allowCurrentPathAccess()) {
82 qDebug() << Q_FUNC_INFO << "access not allowed, pasting not done" << mCurrentDir;
83 return;
84 }
85
86=== modified file 'src/plugin/folderlistmodel/dirmodel.h'
87--- src/plugin/folderlistmodel/dirmodel.h 2015-07-15 18:26:36 +0000
88+++ src/plugin/folderlistmodel/dirmodel.h 2015-09-12 17:21:40 +0000
89@@ -523,7 +523,7 @@
90 #endif
91
92 bool allowAccess(const DirItemInfo &fi) const;
93- bool allowAccess(const QString &path) const;
94+ bool allowCurrentPathAccess() const;
95 bool isAllowedPath(const QString &absolutePath) const;
96 };
97

Subscribers

People subscribed via source and target branches