def sync_all_users_operations(self): from app.entities.user import User # update all the user's pre calculate permissions for user_id in self._users: user = User.get(user_id) user.sync_accessible_ops()
def remove_allowed_operations(self, resource, action_type): """ Removes a particular operations from a Role :param resource: Resource entity :param action_type: ActionType entity :return: """ operation_id = get_operation_identifier(resource, action_type) self.allowed_operations.remove( get_operation_identifier(resource, action_type)) from app.entities.user import User # update all the user's pre calculate permissions for user_id in self._users: user = User.get(user_id) user.remove_accessible_ops(operation_id)
def add_allowed_operations(self, resource, action_type): """ Adds one operations at a time to the particular role ~ Post that updates those operation's permission to Users :param resource: Resource entity :param action_type: ActionType entity :return: """ operation_id = get_operation_identifier(resource, action_type) self.allowed_operations.add(operation_id) from app.entities.user import User # update all the user's pre calculate permissions for user_id in self._users: user = User.get(user_id) user.add_accessible_ops(operation_id)