This is because can.Model creates an instance for each item in the list. You can’t really create instances “around” primitives. I suppose we could create computes here, but this is not a common service result.
So the solution is to turn those strings into an object. The following should work:
However, I’m concerned that the service topology you’re building on top of is a bit awkward. I’m assuming annonymous permissions is the current user’s permissions?
If it is not. Then my guess is that it’s a list of all permissions available. If this is the case, then what you are doing is ok.
If it is the users current permissions, perhaps consider the following:
In apps that I can direct the service layer, I typically have a /session service that I can access like (with can.Model):
Ah, I see. I guess that makes sense given that it is what the documentation says
The anonymous permissions are specified to allow a non-logged on user to access certain functionality. As this product is intended for commercial use the security mechanism needs to be quite flexible.
I do have a session, though.
I did notice that you seem to like to place application service functionality directly on models and even the application state. I’m still learning canjs so perhaps some of the philosophy behind your thinking may rub off. I really do not mind refactoring as I go along so we’ll see.