CityWebConsultants / Iris

Modular content management and web application framework built with Node.js and MongoDB
http://irisjs.org
Other
9 stars 7 forks source link

Socket messages on entity update sent to users without checking view permissions #10

Closed FilipNest closed 8 years ago

FilipNest commented 8 years ago

The entity system has a method for checking if a user is allowed to view an entity ("hook_entity_view"). However, when an entity is updated, created or deleted, socket messages with the entity are sent to all users regardless of permissions.


<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0-rc.0/angular.min.js"></script>
<script src="http://localhost:4000/modules/entity/templates.js"></script>
<script src="http://localhost:4000/modules/angular_live_load/angular_live_load_client.js"></script>

<script>
  iris.server = "http://localhost:4000";

  iris.fetchEntities("users", {

    entities: ["user"],
    sort: {
      "username": "asc"
    },
    limit: 4,
    skip: 0

  })

</script>

<div ng-controller="iris-template" ng-iris-template="users">

  <ul>
    <li ng-repeat="user in users">{{user.username}}</li>

  </ul>

</div>
        iris.sendSocketMessage(["*"], "entityUpdate", data[0]);