forked from microsoft/calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Cherry-Pick: Fixed a graphing calculator "permissions" bug caused by PR #1426 (#1471) #34
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…1426 (microsoft#1471) - The PR microsoft#1426 can cause a crash when no users are returned via `User::FindAllAsync(UserType::LocalUser)` when subsequently trying to access the first user. The existing code also does not guarantee that the returned user is the currently active user. - This fix retrieves the user that opened the app and passes this user into a function to check if this user has the proper permissions to access the graphing mode. This makes sense since the active user is indistinguishable (at least from the app's perspective) to the user who opened the app. This user's permissions are then propagated downwards to properly set up the navigation menu of the app. - Implementation detail worth pointing out: `s_categoryManifest` is what is used to populate the navigation menu of the app, but this variable is static by design, so a separate function was written to override the appropriate `isEnabled` value in `s_categoryManifest`. This function is called by `onLaunched`. - Manual testing
Hi @hanzhang54 , could you help review this PR? thanks |
hanzhang54
approved these changes
May 24, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
tian-lt
added a commit
that referenced
this pull request
May 26, 2021
* change CalcViewModel into a WindowsRuntimeComponent project (#5) * change CalcViewModel into a WindowsRuntimeComponent project * remove the old UI codebase (#6) * initially migrated C# codebase by tian (#7) * initial migrated C# codebase by tian * format the codebase * resolve comments * undo: modifications on UI test project * Remove the blocks that have more than 1 empty line. * Register DP using keyword 'nameof' * C# Migration: Initially migrated C# codebase by Han (#8) * C# Migration: Initially migrated C# codebase by Han * Resolved comments and misssing asset * Added three files to Calculator project * Added TODO comment and updated Object * NavCategory: temporary resolution of the hang issue (#9) * Updated CalcViewModel and missing files (#10) * Updated CalcViewModel and WinMeta * Added Calculator.rc * Resolved comment for InitializeLocalizationSettings * add: views/unitconverter.xaml (#11) * add: views/unitconverter.xaml * format the code * remove the extra empty line * add an empty line * check null before invoking event handlers (#12) * fix problems of the migration of OBSERVABLE_PROPERTY_RW (#13) * fixes crash in MathRichEditBox.ctor() (#14) * fixes crash in MathRichEditBox.ctor() * typo * Update azure-pipelines.ci.yaml for Azure Pipelines * Added a link copy of CalcViewModel to temporarily pass Unit Tests (#16) * Updated CalcViewModelCopyForUT configuration (#17) * changes output path of the UI project to align with other projects (#15) * fixes EETypeLoadException issue: export class DelegateCommand (#18) * fixes EETypeLoadException issue: export class DelegateCommand * weak-reference in C++/CX * WeakRef in C# codebase * UTF-8-BOM * spaces in macro * resolve some comments from the offline review * format * rename file * fixes the memory list issue (#20) * fixes a wrongly migrated property * UTF-8-BOM * fixes up the crash of type casting (#21) * Update localized strings 2021-01-04 (microsoft#1458) (#23) (cherry picked from commit cdcb956) Co-authored-by: Matt Cooley <[email protected]> * Fixup tests (#1429) (#24) - Removed unneeded "ToString" calls - Fixed typos - Renamed "fEButtonState" to "FEButtonState" (cherry picked from commit 66ad328) Co-authored-by: N <[email protected]> * Update graph internal engine verseion (microsoft#1466) (#25) (cherry picked from commit 0048dcb) Co-authored-by: Quentin Al-Timimi <[email protected]> * Turn off DFS file shares in internal build system (microsoft#1470) (#26) (cherry picked from commit 885fa23) Co-authored-by: Matt Cooley <[email protected]> * Improve clarity of math expressions in history for Standard Calculator (feature microsoft#138) (microsoft#1453) (#27) * Implemented feature & added unit tests * Fixed more unit/ui tests * Refactored tests * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp (cherry picked from commit 565e3e2) Co-authored-by: Wei (Waley) Zhang <[email protected]> * Adds unit-test cases for NarratorAnnouncement after fixing issue microsoft#1386 (microsoft#1469) (#28) * fix bug: No confirmation is announced by the narrator after activating 'Remove equation' button microsoft#1386 * Unit Test: Add NarratorAnnouncementUnitTests Co-authored-by: tain <[email protected]> (cherry picked from commit 9d8e2ad) Co-authored-by: Tian L <[email protected]> * Move localization pipeline sync schedule to the YAML file (microsoft#1478) (#30) (cherry picked from commit 007eccd) Co-authored-by: Matt Cooley <[email protected]> * remove the strong reference carried from delegate (#32) * Remove the finalizer of ControlSizeTrigger (#31) * Normalize the namespace of CalcViewModel (#33) * ViewMode: arrange namespaces * UI build pass * run release * UT build pass * pass build * resolve comment: make the diff results cleaner * resolve comment: make the diff results cleaner (2) * resolve comment: make the diff results cleaner (3) * resolve comment: move impl into a namespace * update: spaces * update: CalculatorButtonUser.h * UTF-8 to UTF-8-BOM * remove ViewState.h/.cpp from CalcViewModel path * revert changes for NavCategory.cpp * remove extra space * remove UCM * remove BOM * Fixed a graphing calculator "permissions" bug caused by PR microsoft#1426 (microsoft#1471) (#34) - The PR microsoft#1426 can cause a crash when no users are returned via `User::FindAllAsync(UserType::LocalUser)` when subsequently trying to access the first user. The existing code also does not guarantee that the returned user is the currently active user. - This fix retrieves the user that opened the app and passes this user into a function to check if this user has the proper permissions to access the graphing mode. This makes sense since the active user is indistinguishable (at least from the app's perspective) to the user who opened the app. This user's permissions are then propagated downwards to properly set up the navigation menu of the app. - Implementation detail worth pointing out: `s_categoryManifest` is what is used to populate the navigation menu of the app, but this variable is static by design, so a separate function was written to override the appropriate `isEnabled` value in `s_categoryManifest`. This function is called by `onLaunched`. - Manual testing Co-authored-by: Wei (Waley) Zhang <[email protected]> * fixes up a bug (#35) * fix csproj (#37) Co-authored-by: hanzhang54 <[email protected]> Co-authored-by: Matt Cooley <[email protected]> Co-authored-by: N <[email protected]> Co-authored-by: Quentin Al-Timimi <[email protected]> Co-authored-by: Wei (Waley) Zhang <[email protected]> Co-authored-by: Tian L <[email protected]>
tian-lt
added a commit
that referenced
this pull request
Aug 9, 2021
…oft#1598) * Hello C# - Going to an official feature branch (microsoft#1544) * change CalcViewModel into a WindowsRuntimeComponent project (#5) * change CalcViewModel into a WindowsRuntimeComponent project * remove the old UI codebase (#6) * initially migrated C# codebase by tian (#7) * initial migrated C# codebase by tian * format the codebase * resolve comments * undo: modifications on UI test project * Remove the blocks that have more than 1 empty line. * Register DP using keyword 'nameof' * C# Migration: Initially migrated C# codebase by Han (#8) * C# Migration: Initially migrated C# codebase by Han * Resolved comments and misssing asset * Added three files to Calculator project * Added TODO comment and updated Object * NavCategory: temporary resolution of the hang issue (#9) * Updated CalcViewModel and missing files (#10) * Updated CalcViewModel and WinMeta * Added Calculator.rc * Resolved comment for InitializeLocalizationSettings * add: views/unitconverter.xaml (#11) * add: views/unitconverter.xaml * format the code * remove the extra empty line * add an empty line * check null before invoking event handlers (#12) * fix problems of the migration of OBSERVABLE_PROPERTY_RW (#13) * fixes crash in MathRichEditBox.ctor() (#14) * fixes crash in MathRichEditBox.ctor() * typo * Update azure-pipelines.ci.yaml for Azure Pipelines * Added a link copy of CalcViewModel to temporarily pass Unit Tests (#16) * Updated CalcViewModelCopyForUT configuration (#17) * changes output path of the UI project to align with other projects (#15) * fixes EETypeLoadException issue: export class DelegateCommand (#18) * fixes EETypeLoadException issue: export class DelegateCommand * weak-reference in C++/CX * WeakRef in C# codebase * UTF-8-BOM * spaces in macro * resolve some comments from the offline review * format * rename file * fixes the memory list issue (#20) * fixes a wrongly migrated property * UTF-8-BOM * fixes up the crash of type casting (#21) * Update localized strings 2021-01-04 (microsoft#1458) (#23) (cherry picked from commit cdcb956) Co-authored-by: Matt Cooley <[email protected]> * Fixup tests (#1429) (#24) - Removed unneeded "ToString" calls - Fixed typos - Renamed "fEButtonState" to "FEButtonState" (cherry picked from commit 66ad328) Co-authored-by: N <[email protected]> * Update graph internal engine verseion (microsoft#1466) (#25) (cherry picked from commit 0048dcb) Co-authored-by: Quentin Al-Timimi <[email protected]> * Turn off DFS file shares in internal build system (microsoft#1470) (#26) (cherry picked from commit 885fa23) Co-authored-by: Matt Cooley <[email protected]> * Improve clarity of math expressions in history for Standard Calculator (feature microsoft#138) (microsoft#1453) (#27) * Implemented feature & added unit tests * Fixed more unit/ui tests * Refactored tests * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp * Update HistoryTests.cpp (cherry picked from commit 565e3e2) Co-authored-by: Wei (Waley) Zhang <[email protected]> * Adds unit-test cases for NarratorAnnouncement after fixing issue microsoft#1386 (microsoft#1469) (#28) * fix bug: No confirmation is announced by the narrator after activating 'Remove equation' button microsoft#1386 * Unit Test: Add NarratorAnnouncementUnitTests Co-authored-by: tain <[email protected]> (cherry picked from commit 9d8e2ad) Co-authored-by: Tian L <[email protected]> * Move localization pipeline sync schedule to the YAML file (microsoft#1478) (#30) (cherry picked from commit 007eccd) Co-authored-by: Matt Cooley <[email protected]> * remove the strong reference carried from delegate (#32) * Remove the finalizer of ControlSizeTrigger (#31) * Normalize the namespace of CalcViewModel (#33) * ViewMode: arrange namespaces * UI build pass * run release * UT build pass * pass build * resolve comment: make the diff results cleaner * resolve comment: make the diff results cleaner (2) * resolve comment: make the diff results cleaner (3) * resolve comment: move impl into a namespace * update: spaces * update: CalculatorButtonUser.h * UTF-8 to UTF-8-BOM * remove ViewState.h/.cpp from CalcViewModel path * revert changes for NavCategory.cpp * remove extra space * remove UCM * remove BOM * Fixed a graphing calculator "permissions" bug caused by PR microsoft#1426 (microsoft#1471) (#34) - The PR microsoft#1426 can cause a crash when no users are returned via `User::FindAllAsync(UserType::LocalUser)` when subsequently trying to access the first user. The existing code also does not guarantee that the returned user is the currently active user. - This fix retrieves the user that opened the app and passes this user into a function to check if this user has the proper permissions to access the graphing mode. This makes sense since the active user is indistinguishable (at least from the app's perspective) to the user who opened the app. This user's permissions are then propagated downwards to properly set up the navigation menu of the app. - Implementation detail worth pointing out: `s_categoryManifest` is what is used to populate the navigation menu of the app, but this variable is static by design, so a separate function was written to override the appropriate `isEnabled` value in `s_categoryManifest`. This function is called by `onLaunched`. - Manual testing Co-authored-by: Wei (Waley) Zhang <[email protected]> * fixes up a bug (#35) * fix csproj (#37) Co-authored-by: hanzhang54 <[email protected]> Co-authored-by: Matt Cooley <[email protected]> Co-authored-by: N <[email protected]> Co-authored-by: Quentin Al-Timimi <[email protected]> Co-authored-by: Wei (Waley) Zhang <[email protected]> Co-authored-by: Tian L <[email protected]> * **BYPASS_SECRET_SCANNING** (microsoft#1546) * Fixes a bug about the UI of expression tokens (microsoft#1547) * fix * [FeatureBranch] Fixes x86/ARM/ARM64 builds for the CI-Pipeline (microsoft#1550) * **BYPASS_SECRET_SCANNING** * fix * fixes x86/ARM/ARM64 builds for CI-Pipeline * Add headers missing for compilation with GCC (microsoft#1468) (microsoft#1551) Things that required such update included: * `wstringstream` * `setprecision` * `SCODE_CODE`, `E_BOUNDS` * Various SAL macros Co-authored-by: Michał Janiszewski <[email protected]> * Update nuget.config file (microsoft#1486) (microsoft#1552) Co-authored-by: Matt Cooley <[email protected]> * Fixes up some simple miscellaneous TODO items (microsoft#1556) * #DEBUG is a known C# preprocessor directive * So far, we haven't observed the problem described in the comment from C# async * fixes misc TODO items * resolve some warnings (microsoft#1564) * Add internal CI pipeline (microsoft#1553) (microsoft#1565) * Add CI-internal pipeline * No ARM64, to match release Co-authored-by: Matt Cooley <[email protected]> * Temporarily disable PGO NuGet package (microsoft#1510) (microsoft#1566) Co-authored-by: Matt Cooley <[email protected]> * [C# Calc]Removes WinMeta.cs (microsoft#1567) * remove WinMeta.cs * undo a trivial change * UTF-8 BOM * [C# Calc] Reverts some changes for Currency constants (microsoft#1570) * Update2108release - experimental (microsoft#1572) * adjusts Calculator.csproj (microsoft#1571) * fixes BinSkim problems (microsoft#1573) * fixes an issue around line style (microsoft#1575) * fixes the missed NULLs (microsoft#1576) (microsoft#1578) * Fix the Missing Part in Unit Converter Constructor (microsoft#1579) * fixes: calculator doesn't remember its previous mode (microsoft#1580) * Fixes: GraphingNumber doesn't work correctly (microsoft#1585) * fixes: GraphingNumber doesn't work correctly * Avoid crashing * fixes binding (microsoft#1586) * resolve TODO items (microsoft#1589) * Improving keyboard support in VariableValueSlider (microsoft#1559) (microsoft#1595) Co-authored-by: Dave Grochocki <[email protected]> * [C# Calc] Fixes: Keep the value away from getting rounded in Graphing Mode (microsoft#1596) * keep the value away from getting rounded * set the display precision to 6 to align with C++ impl * fixes the button-light-up time (microsoft#1597) * fixes up merging flaws * Update2108release * fixes (microsoft#1599) * keep master for ci pipeline * remove the Resources filter from CalcViewModel project * removes `that` since `this` can be captured automatically * AppxBundlePlatforms * StampAssemblyInfo * removes PreferredToolArchitecture * Change the arg AppVersion into Version * Change the arg AppVersion into Version * from Calculator.rc to AssemblyInfo.cs * Adds assembly-info Co-authored-by: hanzhang54 <[email protected]> Co-authored-by: Matt Cooley <[email protected]> Co-authored-by: N <[email protected]> Co-authored-by: Quentin Al-Timimi <[email protected]> Co-authored-by: Wei (Waley) Zhang <[email protected]> Co-authored-by: Tian L <[email protected]> Co-authored-by: Michał Janiszewski <[email protected]> Co-authored-by: Dave Grochocki <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-Pick: Fixed a graphing calculator "permissions" bug caused by PR microsoft#1426 (microsoft#1471)
Description of the changes: