Well, it is possible...
For example FDF mod (IIRC) contains setObjectTextureable rank patches which you can set manually (in the mission editor or in a script) on a soldier, but of course that doesn't change according to the unit's rank (set in the editor)..
getRank function can be written, and I was writing such when I stumbled on some problems, and lack of time to solve them..
The problems were just with the method of storing the unit's default rating (the method is a whole other topic, UNN has later 'mastered' that with his get/setInteger functions etc..)) and if would have used some easier solution the function would have worked just fine..
UNN uses a basic version of the getRank function in some of his work..
Anyway, the ranks are based on units rating..
Each rank has a default rating value defined in OFP's main config and based on those values you can build a table of values which you can then crosscheck with the unit's rating and get the units rank...
With every kill (enemy or friendly) the unit's rating changes, so if you only check the unit's rating and base your rank on that you may get faulty results, depending of course when you use the function... With the situ in guestion this should not be a problem at all..
Someone who starts a mission as private could become a colonel in the course of the mission if he/she scores enough enemy kills..
Ok, that's fairly easy to overcome, you just check each units rating at the start of the mission and save their ranks (based on the ratings) somewhere..
With vehicles the rank you set in the editor acts a bit screwy, can't remember what exactly it was..
I think the rank was a bit weirdly 'distributed' in the vehicle, the rank you give for the vehicle in the editor is actually the driver's rank and the rest of the crew are exponentially higher ranks..
That's not a problem either, you just check the vehicle' (ie. the dirver's) rating and based on that give the driver his/her rank, and then give the rest of the crew higher ranks, like if the driver is private, then the gunner is corporal and the commander is sergeant..
Of course you would then need a soldier model on which you have the required selections to setObjectTexture the correct rank patch..