« Finally allowed | Main | I changed the locks »

Restricting blog-administrator privileges in Movable Type

This morning’s project for MPOW drops a heavy hint about what we’re trying to do: could I find a way to give a user in Movable Type blog-administrator privileges (that is, the ability to change settings like the blog name, description, archive method, etc., as well as add/edit/delete entries, change templates, and so on) without letting them change the server path (the directories in which the blog is actually located on the server)?

Changing server paths is a dangerous step on a multi-blog installation. Since all the files are owned, in the filesystem, by whatever user MT.cgi itself runs as, if you change the path for Blog α to match the path of an existing Blog β, then rebuild Blog α, MT will cheerfully overwrite any Blog β files with matching names, including all the feeds, indexes, etc. Then, if Blog β is rebuilt, it will clobber Blog α, and so on. Bad scene.

So we decided to keep that power for the system administrator, not blog administrators. It’s actually pretty simple, if you want to do it on your own multi-blog installation; it just requires some tinkering with the admin interface templates, which are, as near as I can tell, largely undocumented.

  • Find the admin templates. On a default MT install, they’re at $MT_CGI_PATH/tmpl/cms/.
  • Edit cfg_simple.tmpl. Lines 174 through 200 are the ones which show the path information; add <TMPL_IF NAME=IS_ADMINISTRATOR> at the beginning and </TMPL_IF> at the end. You may want to use HTML comments (<!-- comment here -->) to indicate your changes later.
  • Save cfg_simple.tmpl.
  • Edit cfg_archives.tmpl and make the same changes around lines 152 through 210. Save that file.
  • Make a note somewhere about your changes, so if you accidentally blow your changes away in an MT upgrade, you can re-create this!

Now, only a system administrator (not just a blog administrator) can change server paths for blogs on your system.

Now Playing: It’s A Fast Driving Rave Up With The Dandy Warhols Sixteen Minutes from Dandys Rule OK by The Dandy Warhols

Comments

Nice job! This is definitely not a niche need. In fact, we do it on our own Intranet blogs.

However, I might point out that doing this through the Plugin API would be much better for maintenance reasons since upgrades won’t break it or wipe out your changes.

See here for the plugin: http://code.sixapart.com/trac/mtplugins/wiki/RestrictPubPaths

Jay Allen Product Manager - Movable Type Professional Products Group - Six Apart

Thanks for pointing that out, Jay; I wouldn’t have found it otherwise. I checked the plugin, and it almost does what we need - that is, it disables the field, whereas we want to hide them entirely. We’re going to stick to our changes for now, even though it will make upgrades tougher; it’s hardly the only place we’ve hacked the templates.

Post a comment