Skip to content

Commit

Permalink
Merge pull request #4 from clouda-inc/fix/tp-no-condition
Browse files Browse the repository at this point in the history
Block Content for Anonymous Users
  • Loading branch information
lucis authored Sep 10, 2020
2 parents 135afce + 63bec16 commit 3e4eacb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Blocked content for anonymous users

## [1.1.0] - 2020-08-13

### Added
Expand Down
8 changes: 7 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<!-- DOCS-IGNORE:end -->

The Auth Challenge app is an essential B2B feature responsible for checking iif a user is allowed to access the store's content. It helps define which components should be displayed for users that are allowed and users that are not.
The Auth Challenge app is an essential B2B feature responsible for checking if a user is allowed to access the store's content. It helps define which components should be displayed for users that are allowed and users that are not.

## Example Use Case

Add a condition to a TP that applies to your user. As an anonymous user, you should not see the real content. When you log in, and if and only if the condition you added above matches your profile, you should see the real content.

Now remove the condition from the TP that applies to your user. Now as an anonymous user, you should not see the real content. When you login, you should see the real content.

:information_source: This check is made according to the Condition Rule specified in the Trade Policy configuration, one of the steps needed to [**configure a B2B environment in VTEX IO**](https://vtex.io/docs/recipes/store/configuring-a-b2b-environment).

Expand Down
2 changes: 1 addition & 1 deletion react/BlockChallenge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const isProfileAllowed = (sessionResponse: SessionResponse | undefined) => {

const isLoggedIn = (sessionResponse as Session).namespaces?.profile?.email

if (hasAccessToTradePolicy) {
if (isLoggedIn && hasAccessToTradePolicy) {
return 'authorized'
}

Expand Down

0 comments on commit 3e4eacb

Please sign in to comment.