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

Incorrect ~site token resolution for CSOM for the subwebs #863

Closed
SubPointSupport opened this issue Aug 3, 2016 · 2 comments
Closed

Incorrect ~site token resolution for CSOM for the subwebs #863

SubPointSupport opened this issue Aug 3, 2016 · 2 comments

Comments

@SubPointSupport
Copy link
Contributor

Issue

The following model would resolve the ~site token incorrectly, as the curretn sitecollection URL. In fact, all sub-webs' navigation would resolve ~site token as the web URL in the current, giving ClientContext.

var model = SPMeta2Model.NewWebModel(rootWeb =>
            {
                rootWeb.AddWeb(_web, web =>
                {
                    web
                        .AddQuickLaunchNavigationNode(CompanyPortalQuickNavigationNodes.General)

Token resolution for CSOM uses the current ClientContext instead of the "host web", so that all ~site token would always be resolved to the ClientContext's web even for the sub-webs.

Workaround

As a workaround, create a separate model for the subweb, create a new ClientContext and deploy the sub-web with the new ClientContex. In that case, ClientContext would have correct web and the token would be resolved to that web.

Will be fixed in the further SPMeta2 releases.

@SubPointSupport SubPointSupport changed the title Incorrect ~site token resolution for CSOM Incorrect ~site token resolution for CSOM for the subwebs Aug 3, 2016
@SubPointSupport SubPointSupport added this to the 2016-08-15 milestone Aug 3, 2016
@SubPointSupport SubPointSupport modified the milestones: 2016-08-08, 2016-08-15 Aug 4, 2016
@SubPointSupport SubPointSupport self-assigned this Aug 6, 2016
@SubPointSupport
Copy link
Contributor Author

Added the following tests to ensure correct ~site token replacement.

  • Can_Replace_Site_Token_On_RootWeb
  • Can_Replace_Site_Token_On_SubWeb
  • Can_Replace_Site_Token_On_SubSubWeb

SSOM passes.
CSOM fails on Can_Replace_Site_Token_On_SubWeb and Can_Replace_Site_Token_On_SubSubWeb

SubPointSupport added a commit that referenced this issue Aug 6, 2016
+ added tests
* Can_Replace_Site_Token_On_RootWeb
* Can_Replace_Site_Token_On_SubWeb
* Can_Replace_Site_Token_On_SubSubWeb
* CSOMTokenReplacementService_Should_Support_ClientContext
* CSOMTokenReplacementService_Should_Support_SiteModelHost
* CSOMTokenReplacementService_Should_Support_WebModelHost
SubPointSupport added a commit that referenced this issue Aug 6, 2016
+ Passed Can_Replace_Site_Token_On_RootWeb, Can_Replace_Site_Token_On_SubWeb and Can_Replace_Site_Token_On_SubSubWeb tests
+ CSOMTokenReplacementService has AllowClientContextAsTokenReplacementContext flag (false for regression testing, true for production)
+ CSOMTokenReplacementService and client context reengineering across CSOM model handlers, always pass CSOM model host instead of ClientContext
+ full CSOM regression testing
@SubPointSupport
Copy link
Contributor Author

Added the following tests, all passed. CSOM re-engineering for all CSOM based model handler, full CSOM regression testing.

  • CSOMTokenReplacementService_Should_Support_ClientContext
  • CSOMTokenReplacementService_Should_Support_SiteModelHost
  • CSOMTokenReplacementService_Should_Support_WebModelHost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant