Fix incorrect comparision with resource id.

Casting to string is required for user id to compare with resource id
becuase the id's type has been changed to string since
412ff1984128f70a561d70ab69831d30dbffa7ec.

This also fixes 403 forbidden while deleting a temporary attachment.