class RoomUpdateArgsSchema(mm.Schema): verbose_name = fields.String(allow_none=True) site = fields.String(allow_none=True) building = fields.String(validate=lambda x: x is not None) floor = fields.String(validate=lambda x: x is not None) number = fields.String(validate=lambda x: x is not None) longitude = fields.Float(allow_none=True) latitude = fields.Float(allow_none=True) is_reservable = fields.Boolean(allow_none=True) reservations_need_confirmation = fields.Boolean(allow_none=True) notification_emails = fields.List(fields.Email()) notification_before_days = fields.Int(validate=lambda x: 1 <= x <= 30, allow_none=True) notification_before_days_weekly = fields.Int(validate=lambda x: 1 <= x <= 30, allow_none=True) notification_before_days_monthly = fields.Int(validate=lambda x: 1 <= x <= 30, allow_none=True) notifications_enabled = fields.Boolean() end_notification_daily = fields.Int(validate=lambda x: 1 <= x <= 30, allow_none=True) end_notification_weekly = fields.Int(validate=lambda x: 1 <= x <= 30, allow_none=True) end_notification_monthly = fields.Int(validate=lambda x: 1 <= x <= 30, allow_none=True) end_notifications_enabled = fields.Boolean() booking_limit_days = fields.Int(validate=lambda x: x >= 1, allow_none=True) owner = Principal(validate=lambda x: x is not None, allow_none=True) key_location = fields.String() telephone = fields.String() capacity = fields.Int(validate=lambda x: x >= 1) division = fields.String(allow_none=True) surface_area = fields.Int(validate=lambda x: x >= 0, allow_none=True) max_advance_days = fields.Int(validate=lambda x: x >= 1, allow_none=True) comments = fields.String() acl_entries = PrincipalPermissionList(RoomPrincipal) protection_mode = EnumField(ProtectionMode)
class RoomUpdateSchema(RoomSchema): owner = Principal() acl_entries = PrincipalPermissionList(RoomPrincipal) protection_mode = EnumField(ProtectionMode) class Meta(RoomSchema.Meta): fields = RoomSchema.Meta.fields + ('notification_before_days', 'notification_before_days_weekly', 'owner', 'notification_before_days_monthly', 'notifications_enabled', 'end_notification_daily', 'end_notification_weekly', 'end_notification_monthly', 'end_notifications_enabled', 'verbose_name', 'site', 'notification_emails', 'booking_limit_days', 'acl_entries', 'protection_mode')
class TrackPermissionsSchema(mm.Schema): acl_entries = PrincipalPermissionList(TrackPrincipal)
class EventPermissionsSchema(mm.Schema): acl_entries = PrincipalPermissionList(EventPrincipal, all_permissions=True)
'key_location': fields.Str(), 'telephone': fields.Str(), 'capacity': fields.Int(validate=lambda x: x >= 1), 'division': fields.Str(allow_none=True), 'surface_area': fields.Int(validate=lambda x: x >= 0, allow_none=True), 'max_advance_days': fields.Int(validate=lambda x: x >= 1, allow_none=True), 'comments': fields.Str(), 'acl_entries': PrincipalPermissionList(RoomPrincipal), 'protection_mode': EnumField(ProtectionMode) } class RHRoom(RHRoomAdminBase): def _process_GET(self): return jsonify(room_update_schema.dump(self.room)) @use_args(room_update_args) def _process_PATCH(self, args): update_room(self.room, args) RHRoomsPermissions._jsonify_user_permissions.clear_cached(session.user) return '', 204