Skip to content

Commit

Permalink
BUGFIX: Fix conflict between Sandstorm.UserManagement Frontend Reques…
Browse files Browse the repository at this point in the history
…t Pattern and /neosh5p routes by changing all routes to /h5p
  • Loading branch information
Bastian Heist committed May 24, 2019
1 parent 1ee54f3 commit 87f86fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 51 deletions.
26 changes: 13 additions & 13 deletions Configuration/Routes.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
# backend editor ajax routes
-
name: 'H5P Backend Editor AJAX'
uriPattern: 'neosh5p/editor'
uriPattern: 'h5p/editor'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Backend\EditorAjax'
'@action': 'index'
-
name: 'H5P Backend Editor AJAX - content type cache'
uriPattern: 'neosh5p/editor/content-type-cache'
uriPattern: 'h5p/editor/content-type-cache'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Backend\EditorAjax'
'@action': 'contentTypeCache'
-
name: 'H5P Backend Editor AJAX - library install'
uriPattern: 'neosh5p/editor/library-install'
uriPattern: 'h5p/editor/library-install'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Backend\EditorAjax'
'@action': 'installLibrary'
-
name: 'H5P Backend Editor AJAX - library upload'
uriPattern: 'neosh5p/editor/library-upload'
uriPattern: 'h5p/editor/library-upload'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Backend\EditorAjax'
'@action': 'uploadLibrary'
-
name: 'H5P Backend Editor AJAX - single library details'
uriPattern: 'neosh5p/editor/libraries'
uriPattern: 'h5p/editor/libraries'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Backend\EditorAjax'
'@action': 'libraryDetails'
httpMethods: ['GET']
-
name: 'H5P Backend Editor AJAX - multiple libraries'
uriPattern: 'neosh5p/editor/libraries'
uriPattern: 'h5p/editor/libraries'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Backend\EditorAjax'
'@action': 'libraries'
httpMethods: ['POST']
-
name: 'H5P Backend Editor AJAX - editor file upload'
uriPattern: 'neosh5p/editor/files'
uriPattern: 'h5p/editor/files'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Backend\EditorAjax'
Expand All @@ -55,15 +55,15 @@
# backend content upgrade ajax routes
-
name: 'H5P Backend content upgrade AJAX - execute content upgrade'
uriPattern: 'neosh5p/contentupgrade/migrate/{oldLibraryId}'
uriPattern: 'h5p/contentupgrade/migrate/{oldLibraryId}'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Backend\ContentUpgradeAjax'
'@action': 'migrateContent'
httpMethods: ['POST']
-
name: 'H5P Backend content upgrade AJAX - get library info'
uriPattern: 'neosh5p/contentupgrade/libraryinfo(/{libraryName}/{majorVersion}/{minorVersion})'
uriPattern: 'h5p/contentupgrade/libraryinfo(/{libraryName}/{majorVersion}/{minorVersion})'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Backend\ContentUpgradeAjax'
Expand All @@ -75,14 +75,14 @@
# frontend ajax routes
-
name: 'H5P Frontend AJAX - save results'
uriPattern: 'neosh5p/contentresults/save'
uriPattern: 'h5p/contentresults/save'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Frontend\ContentResults'
'@action': 'save'
-
name: 'H5P Frontend AJAX - save content user data'
uriPattern: 'neosh5p/contentuserdata/save/{queryString}'
uriPattern: 'h5p/contentuserdata/save/{queryString}'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Frontend\ContentUserData'
Expand All @@ -92,7 +92,7 @@
# embed route for content
-
name: 'H5P Frontend - embed content as iframe'
uriPattern: 'neosh5p/content/embed/{contentId}'
uriPattern: 'h5p/content/embed/{contentId}'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Frontend\ContentEmbed'
Expand All @@ -101,7 +101,7 @@
# neos fullscreen inspector routes
-
name: 'H5P Neos inspector - fullscreen editor content controller routes'
uriPattern: 'neosh5p/contentfullscreeneditor/{@action}(/{content})'
uriPattern: 'h5p/contentfullscreeneditor/{@action}(/{content})'
defaults:
'@package': 'Sandstorm.NeosH5P'
'@controller': 'Backend\Content'
Expand Down
13 changes: 0 additions & 13 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,6 @@ Neos:
Sandstorm.NeosH5P: true

Flow:
# We add a request pattern for our controllers to the Neos Backend provider,
# so that XHR requests that go directly to these controllers (and not through
# a ModuleController subrequest) can be authenticated as well
security:
authentication:
providers:
'Neos.Neos:Backend':
requestPatterns:
'Sandstorm.NeosH5P:BackendControllers':
pattern: 'ControllerObjectName'
patternOptions:
controllerObjectNamePattern: 'Sandstorm\NeosH5P\Controller\Backend\.*'

# We need the tag "@variable" as an ignored annotation, because otherwise parsing of the
# H5PFrameworkInterface causes a reflection error
reflection:
Expand Down
31 changes: 6 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ H5P supports persisting content state (e.g. the currently selected answers to mu
results (e.g. answers given by a user to a multiple choice question). In order for this to work in Neos, we need to
add a few settings.

1. In your site package's `Policy.yaml`, provide the permission to use the controller actions to the role which you
want to be able to use them. If you're using a frontend login package like [Sandstorm.UserManagement](https://github.com/sandstorm/UserManagement),
your config could look like below. Replace the role `Sandstorm.UserManagement:User` with the one your frontend users
actually have. If you want to save content results and user data even for non-logged-in users, set this to
`Neos.Flow:Everybody`. Mind the GDPR implications of this, as you're then persisting data of every user that
interacts with H5P content on your site.
In your site package's `Policy.yaml`, provide the permission to use the controller actions to the role which you
want to be able to use them. If you're using a frontend login package like [Sandstorm.UserManagement](https://github.com/sandstorm/UserManagement),
your config could look like below. Replace the role `Sandstorm.UserManagement:User` with the one your frontend users
actually have. If you want to save content results and user data even for non-logged-in users, set this to
`Neos.Flow:Everybody`. Mind the GDPR implications of this, as you're then persisting data of every user that
interacts with H5P content on your site.

```YAML
roles:
Expand All @@ -67,25 +67,6 @@ roles:
permission: GRANT
```
2. In your site package's `Settings.yaml`, you need to add a request pattern so our controllers can recognize the correct
authenticated account. Again, the exact setting is dependent on which frontend login package you use. If you're using
[Sandstorm.UserManagement](https://github.com/sandstorm/UserManagement), the setting looks like this. If you're using
a different package or created your own frontend login, replace the provider `Sandstorm.UserManagement:Login` with the
one you are using.
```YAML
Neos:
Flow:
security:
authentication:
providers:
'Sandstorm.UserManagement:Login':
requestPatterns:
'Sandstorm.NeosH5P:FrontendControllers':
pattern: 'ControllerObjectName'
patternOptions:
controllerObjectNamePattern: 'Sandstorm\NeosH5P\Controller\Frontend\.*'
```

## 3. Integrate xAPI
You can control which username and email address is sent in xAPI statements by implementing your own implementation of
the `FrontendUserServiceInterface`. Check the default `Sandstorm\NeosH5P\Domain\Service\FrontendUserService` for an
Expand Down

0 comments on commit 87f86fa

Please sign in to comment.