Most other tasks have to be carried out by dwarfs, but locking and unlocking doors is magically done automatically when you order it. While practical it feels like it goes against the spirit of the game. While fixing that, further enhancements could be done to the doors as well, namely:
Defining the "inside" of the door. A simple choice of west over east, or north over south depending on the orientation of the door. The inside of the door becomes important for later features.
Defining who may or may not pass, and who may or may not open the door. Two selections here: {everyone may pass, military may pass, none may pass} and {everyone may open, military may open, none may open}.
That way you could set it up so that, for example, anyone may pass the door, but only the military may open it.
If a civilian wants to come through, they will generate an "open door" job for the nearest available military unit to pick up. The military unit will come open the door and the civilian goes through.
Also, if anyone may come through and anyone may open it, a civilian coming from the outside (see below) would need to signal someone on the inside, generating an "open door" job for the nearest available dwarf to pick up.
More locking options. Instead of just "lock" vs. "unlock" there would be options like "bolt" (a simple deadbolt applied from the outside that would make the door resist picking attempts) and "bar" (a heavy bar which takes some time to apply and remove, and which makes the door resist being knocked down).
Obviously a deadbolt or a bar would only be operable from one side, this side being the "inside" defined earlier.