1

Is it possible to add the default user session whos user name is "default guest" to a custom group (ex. Guest) to be able to make use of the Wakanda class permissions?

enter image description here

Or group methods like this?

currentSession().belongsTo('Guest') // true
Stefan
  • 425
  • 2
  • 8
  • Try adding the "default user" to a group. You can retrieve the object with `currentUser().user`. Then use the API to add it one time to a group like "Anonymous". Those permissions are available only for groups, so if you are able to add the default user to any group, you can manage his permissions. – Jonathan Argentiero Feb 01 '17 at 08:57
  • added `currentSession().user.putInto(['Guest']);` to my bootstrap file, but this doesn't do the trick. also `currentSession().promoteWith('Guest');` in the bootstrap file does not work? any help is much appreciated – Stefan Feb 01 '17 at 14:21
  • You can create a mock "anonymousUser" and log in the user at application start if it's anonymous with that user. Then add the privileges to it. – Jonathan Argentiero Feb 01 '17 at 16:45
  • This is what I did as a workaround, but it looks like there is no other option. Thanks anyway for all the help. – Stefan Feb 07 '17 at 07:13
  • Don't worry. I'll add it as an answer since it's the only solution available. – Jonathan Argentiero Feb 13 '17 at 09:09

1 Answers1

2

Unfortunately a documented way to alter the permissions of an anonymous user is not available at the moment.

An alternative way consist into creating a custom "anonymousUser", add it the custom "Guest" group and modify the "Guest" group permissions attaching to it the desired restrictions.

This custom anonymousUser should be logged in at the application start/page view emulating the behavior of anonymous user.

Jonathan Argentiero
  • 5,687
  • 8
  • 29
  • 34