We've been over this before. A simple bill does not over rule the Constitution.
And the President does not write legislation, the legislature does that. So don't blame Obama, blame Congress.
Obama was in a "damned if he did, damned if he didn't" situation. If he signs he is accused of taking away people's rights, if he vetoes he accused of not supporting the military (the bill is actually a military funding bill). So he took a page from the Bush strategy, and signed it with a statement that he would just ignore that parts of the bill he disagreed with.