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 upload permissions and centralize download permissions #7109

Merged
merged 1 commit into from
Feb 14, 2023

Conversation

larkox
Copy link
Contributor

@larkox larkox commented Feb 13, 2023

Summary

The logic about the checking if files can be uploaded was wrong. I fixed it and added some tests for it.

I also piggybacked some changes about the download logic, to centralize it, and added also tests.

Ticket Link

Fix https://mattermost.atlassian.net/browse/MM-50448

Release Note

Fix bug where "enableMobileUploadFiles" setting was not working correctly.

@larkox larkox added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Feb 13, 2023
@larkox larkox requested a review from enahum February 13, 2023 12:08
Copy link
Contributor

@enahum enahum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be cherrypicked to 2.1

@enahum enahum added CherryPick/Approved Meant for the quality or patch release tracked in the milestone and removed 2: Dev Review Requires review by a core commiter labels Feb 13, 2023
@enahum enahum added this to the v2.1 milestone Feb 13, 2023
@larkox larkox requested a review from furqanmlk February 13, 2023 12:13
@larkox
Copy link
Contributor Author

larkox commented Feb 13, 2023

@furqanmlk Adding you as one of the QA from the core teams. If you find someone else should be testing this, feel free to reassign.

@enahum
Copy link
Contributor

enahum commented Feb 13, 2023

We should be cutting 2.1 not later than Wednesday

@enahum
Copy link
Contributor

enahum commented Feb 14, 2023

@furqanmlk please do prioritize this PR as I need to merge it ASAP!!

Copy link
Contributor

@furqanmlk furqanmlk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@larkox
I am still able to upload and download files when settings are
"EnableMobileUpload": false,
"EnableMobileDownload": false,
Please see the attached recording.
am I missing something?

Filmage.2023-02-14_144234.mp4

@enahum
Copy link
Contributor

enahum commented Feb 14, 2023

@furqanmlk have you made the changes to the config file directly instead of using the admin console? and if so, once you made the change, did you restarted the server? and if so, have you restarted the app (just in case)? if you use the browser to get the client config what values do you get for those settings?

@amyblais amyblais requested a review from furqanmlk February 14, 2023 20:02
@furqanmlk
Copy link
Contributor

@furqanmlk have you made the changes to the config file directly instead of using the admin console? and if so, once you made the change, did you restarted the server? and if so, have you restarted the app (just in case)? if you use the browser to get the client config what values do you get for those settings?

@enahum

  1. Changed following config.json settings
    "EnableMobileUpload": false,
    "EnableMobileDownload": false
  2. Restarted server make restart-server
  3. Close the Mobile app and relaunched
  4. Verified values are still false at http://localhost:8065/api/v4/config

image

@enahum
Copy link
Contributor

enahum commented Feb 14, 2023

@furqanmlk the results of the http://localhost:8065/api/v4/config/client?format=old endpoint

@furqanmlk
Copy link
Contributor

http://localhost:8065/api/v4/config/client?format=old

image

There is no closing bracket

@enahum
Copy link
Contributor

enahum commented Feb 14, 2023

There is no closing bracket

Oh there is, and there are a bunch more values there

@furqanmlk
Copy link
Contributor

There is no closing bracket

Oh there is, and there are a bunch more values there

Sorry there was another option to view source
{ "AboutLink": "https://docs.mattermost.com/about/product.html", "AndroidAppDownloadLink": "https://mattermost.com/mattermost-android-app/", "AndroidLatestVersion": "", "AndroidMinVersion": "", "AppDownloadLink": "https://mattermost.com/download/#mattermostApps", "AsymmetricSigningPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEgHSlZxPm5K2ZHY2ueOPhY0t5xlhxFZSyN9o/7wVby4RgJKnMRRu821pOzRMMEOHFWwV0pKFdyYFTSpE18ofYUQ==", "BuildBoards": "true", "BuildDate": "n/a", "BuildEnterpriseReady": "true", "BuildHash": "079449e30af683c5c8115b91e53661372b86da30", "BuildHashBoards": "08ce9a753d77eca18ae385ac09dceb246f955254", "BuildHashEnterprise": "3e48c65107e6b77d422dc2f67e846ecb8d2ee665", "BuildHashPlaybooks": "none", "BuildNumber": "dev", "CWSURL": "", "CustomBrandText": "", "CustomDescriptionText": "", "DefaultClientLocale": "en", "DiagnosticId": "j9wd6fn14py58egkk9kbq5qyja", "DiagnosticsEnabled": "true", "EmailLoginButtonBorderColor": "#2389D7", "EmailLoginButtonColor": "#0000", "EmailLoginButtonTextColor": "#2389D7", "EnableAskCommunityLink": "true", "EnableBotAccountCreation": "true", "EnableComplianceExport": "false", "EnableCustomBrand": "false", "EnableCustomEmoji": "false", "EnableDiagnostics": "true", "EnableFile": "true", "EnableGuestAccounts": "true", "EnableLdap": "false", "EnableMultifactorAuthentication": "false", "EnableOpenServer": "true", "EnableSaml": "false", "EnableSignInWithEmail": "true", "EnableSignInWithUsername": "true", "EnableSignUpWithEmail": "true", "EnableSignUpWithGitLab": "false", "EnableSignUpWithGoogle": "false", "EnableSignUpWithOffice365": "false", "EnableSignUpWithOpenId": "false", "EnableUserCreation": "true", "EnforceMultifactorAuthentication": "false", "FeatureFlagAnnualSubscription": "false", "FeatureFlagAppsEnabled": "true", "FeatureFlagBoardsDataRetention": "false", "FeatureFlagBoardsFeatureFlags": "", "FeatureFlagBoardsProduct": "true", "FeatureFlagCallsEnabled": "true", "FeatureFlagCommandPalette": "false", "FeatureFlagEnableInactivityCheckJob": "true", "FeatureFlagEnableRemoteClusterService": "false", "FeatureFlagGlobalDrafts": "true", "FeatureFlagGraphQL": "true", "FeatureFlagInsightsEnabled": "true", "FeatureFlagNormalizeLdapDNs": "false", "FeatureFlagOnboardingAutoShowLinkedBoard": "true", "FeatureFlagOnboardingTourTips": "true", "FeatureFlagPeopleProduct": "false", "FeatureFlagPermalinkPreviews": "true", "FeatureFlagPluginApps": "", "FeatureFlagPluginCalls": "", "FeatureFlagPluginFocalboard": "", "FeatureFlagPluginPlaybooks": "", "FeatureFlagPostPriority": "true", "FeatureFlagReduceOnBoardingTaskList": "false", "FeatureFlagSendWelcomePost": "true", "FeatureFlagTestBoolFeature": "false", "FeatureFlagTestFeature": "off", "FeatureFlagThreadsEverywhere": "false", "FeatureFlagUseCaseOnboarding": "true", "FeatureFlagWorkTemplate": "false", "FeatureFlagWysiwygEditor": "false", "FileLevel": "INFO", "GitLabButtonColor": "", "GitLabButtonText": "", "GuestAccountsEnforceMultifactorAuthentication": "false", "HasImageProxy": "true", "HelpLink": "https://mattermost.com/default-help/", "IosAppDownloadLink": "https://mattermost.com/mattermost-ios-app/", "IosLatestVersion": "", "IosMinVersion": "", "LdapLoginButtonBorderColor": "", "LdapLoginButtonColor": "", "LdapLoginButtonTextColor": "", "LdapLoginFieldName": "", "NoAccounts": "false", "OpenIdButtonColor": "", "OpenIdButtonText": "", "PasswordMinimumLength": "5", "PasswordRequireLowercase": "false", "PasswordRequireNumber": "false", "PasswordRequireSymbol": "false", "PasswordRequireUppercase": "false", "PluginsEnabled": "true", "PrivacyPolicyLink": "https://mattermost.com/privacy-policy/", "ReportAProblemLink": "https://mattermost.com/default-report-a-problem/", "SamlLoginButtonBorderColor": "", "SamlLoginButtonColor": "", "SamlLoginButtonText": "", "SamlLoginButtonTextColor": "", "SiteName": "Mattermost", "SiteURL": "http://127.0.0.1:8065", "SupportEmail": "", "TelemetryId": "j9wd6fn14py58egkk9kbq5qyja", "TermsOfServiceLink": "https://mattermost.com/terms-of-use/", "Version": "7.8.0", "WebsocketPort": "80", "WebsocketSecurePort": "443", "WebsocketURL": "" }

@enahum
Copy link
Contributor

enahum commented Feb 14, 2023

@furqanmlk based on what you pasted, the problem is the config the server is returning, not sure what server are you using and what is your setup, but that config definitely has a log of missing key values

@furqanmlk
Copy link
Contributor

@furqanmlk based on what you pasted, the problem is the config the server is returning, not sure what server are you using and what is your setup, but that config definitely has a log of missing key values

I am using local setup. let me re-try

@enahum
Copy link
Contributor

enahum commented Feb 14, 2023

I just tested it on my local setup and is working just fine for me

@furqanmlk
Copy link
Contributor

I just tested it on my local setup and is working just fine for me

hmm
I am getting True values for
EnableMobileFileDownload: "true",
EnableMobileFileUpload: "true",

I restarted the server and restarted the mobile app

image

image

@enahum
Copy link
Contributor

enahum commented Feb 14, 2023

@furqanmlk maybe you are using the config from the database and not the file? perhaps use the admin console to set them
image

@furqanmlk
Copy link
Contributor

thanks @enahum

I dont know why it is not taking effect from config.json

Disabled Downlaod

image

Disabled Upload

image

@enahum enahum merged commit f23960d into mattermost:main Feb 14, 2023
@mattermost-build
Copy link
Contributor

Cherry pick is scheduled.

mattermost-build pushed a commit to mattermost-build/mattermost-mobile that referenced this pull request Feb 14, 2023
@mattermost-build mattermost-build added CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone and removed CherryPick/Approved Meant for the quality or patch release tracked in the milestone labels Feb 14, 2023
enahum pushed a commit that referenced this pull request Feb 14, 2023
…7119)

(cherry picked from commit f23960d)

Co-authored-by: Daniel Espino García <larkox@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: QA Review Requires review by a QA tester CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants