Hiding Active Directory user IDs from WordPress author slugs

I recently set up a corporate WordPress blog system. With the Active Directory Integration plugin, users can sign in with their corporate ID and password.

But here’s a problem: each blog post has a link to the author’s profile. That profile’s URL includes the user ID. The corporation’s security standards say we can’t expose user IDs to the world, so the author profile URLs have to be sanitized.

It took a while to figure out a solution, but the end result is reasonable.

I found this post at StackExchange’s WordPress site. Adding the first two code snippets (below) to the end of wp-config.php tells WordPress to use the user’s nickname metadata to construct the profile URLs:

add_filter( 'request', 'wpse5742_request' );function wpse5742_request( $query_vars )
 
{
 if ( array_key_exists( 'author_name', $query_vars ) ) {
 global $wpdb;
 $author_id = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key='nickname' AND meta_value = %s", $query_vars['author_name'] ) );
 if ( $author_id ) {
 $query_vars['author'] = $author_id;
 unset( $query_vars['author_name'] );
 }
 }
 return $query_vars;
}
 
add_filter( 'author_link', 'wpse5742_author_link', 10, 3 );
function wpse5742_author_link( $link, $author_id, $author_nicename)
{
 $author_nickname = get_user_meta( $author_id, 'nickname', true );
 if ( $author_nickname ) {
 $link = str_replace( $author_nicename, $author_nickname, $link );
 }
 return $link;
}

But wait, there’s more!

Now you have to get a proper value into the nickname field. Active Directory Integration makes this easy. In this plugin’s settings, go to the User Meta tab and enter this into the Additional User Attributes field: mailnickname:string:nickname. You’ll may need to replace mailnickname with your own Active Directory user attribute if it isn’t appropriate for you.

That’s it. The next time a user logs in, the nickname field is updated, and all future profile URLs for that user will not have a user ID.

Skepticism of the law

I’m not a Lawrence Lessig fan. He’s too radical, but he still had a great quote last year:

…I am a little surprised by the respect that non lawyers typically give the law. Because lawyers’ view is one of constant skepticism. We constantly ask and demand of the law that it explain to us: How does this make sense? And we never presume that we happen to have a body of regulation that makes sense. We always examine. Where it does make sense, we say good for the law, and we encourage people to follow it. But where it makes no sense, our perspective is that the law needs to be changed.

He only encourages obedience to laws that make sense. Later he wrote “Stop believing, stop listening, stop deferring. Feel entitled to question this system.

(Getting Our Values around Copyright Right, EDUCAUSE Review, March/April 2010)

This is refreshing. Usually, I see the paintywaist viewpoint, that all law deserves to be obeyed just because it exists.

No!

Law is just an approximation of right and wrong. It’s often off.

Americans were once required to return slaves, but it was never wrong to ignore this law and help slaves become free. Similarly, suppose 75 mph is safe on a road. 75 mph is illegal if the speed limit sign says 65, but it’s not wrong.

Educause: Outsource the Transactional, Keep the Transformative

Educause’s recent Outsource the Transactional, Keep the Transformative complements my recent article questioning the value of IT projects.

In my article, I said that work  easily expressed as a classical/waterfall project probably has less intrinsic business value. This includes stuff like routine infrastructure and commodity services.

The Educause piece has a graph showing how Pepperdine University rated the value of its in-house IT services:

(Click the image to see the full size.)

Sampling of services with lowest value or transformative potential, mostly the stuff of process or where classical/waterfall projects are normative:

  • Windows administration
  • Security
  • DBAs
  • Help Desk (outsourcing this is the theme of the Educause article)

And services with the highest value or transformative potential, the stuff of agility:

  • EIS functional (basically business analysts)
  • Portal
  • Technology & Learning Team
  • University Planning (basically enterprise architecture)

I chuckled at security’s inclusion in the least value segment. Security has always lived in a halo of insecurity; their value is in what didn’t happen. How do you express that? Regardless, you’d be crazy not to have a good security team.

How about the rest? Does this mean Windows administrators, DBAs, help desk staff, etc. should quake in their boots?

Depends. In the near term, I don’t see a sea change, but I also don’t see growing opportunities for work on the bottom left of the graph. Long-term, the outsourcing question is “when”, not “if”. And until then, the value of work on the bottom left isn’t intrinsic; it’s measured by what it enables the people on the top right to do. If the bottom lefters aren’t helping the top righters, they are nailing their own coffin.

Once the outsourcing begins, I’d hope that it results in either:

  1. Equivalent position at the outsourcer. I saw a university do this when it outsourced its trades department (HVAC, plumbing, landscaping, etc.). If you enjoy the trade, this can be good; you’ll probably have more growth opportunities versus pigeonholing with an employer where your trade is ephemeral. This is already happening to pure-play programmers, too, but that’s a subject for a different day.
  2. You get reassigned within the original employer. This is what Pepperdine did (see bottom of page 1 of this). But–and this is a big but!–it’s only going to work if you’re versatile and able. If you’re a one shot wonder, have little skills depth, or find it difficult to adapt, this could be the beginning of a downward spiral.

So what to make of this? Two things.

First, if your job is routine, process-driven, or involves a lot of waterfall projects, you may not be high on the business value ladder. These positions will be scrutinized. Make sure you are versatile enough to merit and survive reassignment.

Second, watch what’s going on around you. Where are you, your immediate coworkers, and your department headed? Is the cliched “writing on the wall”? Sometimes, you need to be proactive and transform yourself up the business value ladder.

Transformation, agility, and business value are the future of IT. Process and waterfall’s share of that future is declining. Be prepared.

Design speed shouldn’t block higher speed limits

Thanks to a bill recently signed by the governor, the Texas Transportation Commission, which oversees TxDOT, may establish speed limits up to 85 mph on any state highway.

The bill uses the word “designed”. I’m afraid this may be misinterpreted to mean the civil engineering concept of “design speed”.

“Design speed” is not the maximum safe speed. It’s only a tool to guide road design. At best, it’s a conservative first guess of a speed limit; it’s often OK to set higher speed limits.

The TTC still has to change some rules before we can possibly see higher limits. They’ll probably adopt whatever TxDOT recommends. I sent the below letter to TxDOT to encourage them to not conflate the bill’s language with the civil engineering concept. I got a positive response, but the proof will come when the TTC adopts the speed zoning procedure revisions.

The letter:

HB 1201, which was just signed by the governor, allows the TTC to set a speed limit up to 85 mph on any road provided that “that part of the highway system is designed to accommodate travel at that established speed or a higher speed” and a standard engineering study was run.

This is a good thing. The old 70 mph limit was legislated in 1963. It’s now 48 years later, and 85 mph is perfectly safe on many roads with our drastically improved vehicle and road technology.

Here’s my concern: I hope the word “designed” in the revised statute will not be misinterpreted and become a roadblock to higher speed limits.

There is a concept of “design speed” in civil engineering. However, a design speed is a poor guide for a road’s true maximum safe speed for at least three reasons:

1. A road’s design speed that of its worst part. Suppose a 50 mph road has a 40 mph curve. By definition, the road’s design speed is only 40 mph. In the real world, the road should be signed at 50 mph, and yellow warning diamonds would be posted at the curve recommending 40 mph.

2. Design speeds assume characteristics of vehicles and road technology of the past. So a design speed established in 2011 will assume the inferior stopping distances, power, and safety of vehicles from many years ago. Even worse, most Texas rural roads were designed decades ago (e.g., back when cars had poor drum brakes, biased ply tires, weak horsepower, little safety equipment, dim headlights, no ABS or stability control, etc.). Design speeds established way back then will certainly understate what today’s on-road fleet can safely handle.

3. MOST IMPORTANTLY: Per the AASHTO, the design speed is merely “a selected speed used to determine the various geometric design features of a roadway”. Therefore, it is really only a theoretical/laboratory measurement. Its purpose is not to determine a speed limit.

The design speed must not be interpreted as a maximum possible safe speed. At best, it is only a conservative “first guess” of an appropriate speed limit; a road’s true safe speed may easily be higher.

To conclude, I ask that, as the TTC revises speed zoning regulations to accommodate HB 1201, that it not hamstring the speed zoning process with the civil engineering concept of “design speed”. Certainly in its use of “designed”, the legislature did not mean to invoke this specific concept. In doing so, Texas would misuse a theoretical, laboratory measurement whose purpose was never to be an absolute cap on speed limits.

(AASHTO is the American Association of State Highway and Transportation Officials.)

Left wing tripe

My church, First United Methodist Church of Dallas, has a Sunday school class afflicted with a radical left winger.

If you’re one of my Facebook buddies, you’ll remember this from January 9, 2011:

Wonderful, call a substantial portion of the electorate “stupid people”…

Now it gets more nerdy and nuanced. The same class now has this on its tackboard:

The point here is to get sympathetic liberals to hand-wring over military spending.

Except it’s a lie. It conveniently omits about 2/3 of federal spending!

Here’s a truer picture of federal spending:
(image source: Wikipedia image and article)

It’s more like 20% of federal spending!

Now, to be frank, while I believe in a strong defense, I am uncomfortable that the United States alone accounts for about 40% of worldwide defense spending. I’d like to scrutinize our defense spending, but I’m not going to lie about it with convenient numbers.

And I’m also not going to lie and slander in church.