Forum .LRN Q&A: getting admin permissions right in file-storage

I've been told that until recently (probably the 4.6.3 merge), on Sloanspace, class admins (TAs, Professors, etc) had admin rights on files in file storage.  So if a TA uploaded a file, the Professor could come along and delete it.  This functionality is no longer working.

I have made it work again by adding the following code to the db_transaction block that creates a new uploaded file:

    if {[apm_package_installed_p "dotlrn"]} {
        # We also want all group admins to have full rights on the file
        set admins [dotlrn_community::get_rel_segment_id \
            -community_id [dotlrn_community::get_community_id] \
            -rel_type dotlrn_admin_rel \
        ]
        permission::grant -party_id $admins -object_id $file_id -privilege admin
    }

However, there are two things about this that bother me:
- I don't like littering packages with dotlrn conditionals
- it was, at least theoretically, working this way before, and I can't find any signs of this code having existed previously and having been merged out of existence.

Can anyone suggest a better way to accomplish this?  TIA!