Topic: Using Content Licenses in Kete 1.1

Topic Type: Topic

When you install Kete 1.1 or upgrade from 1.0 to 1.1, you can use these steps to install licenses, set a default site license, bulk update the content licenses on the site, and notify contributors of the licensing functionality.

Originally written by Kieran Pilkington, Kete Developer for Katipo Communications, Ltd.

An appendix to the Installation Guide

Disclaimer

Due to possible copyright violations by changing licenses, make sure you do one of two things. Either:

  • Change everything on the site to the same license as described in the Terms and Conditions of your site if you have one

or

  • Update the licenses only on content you created and are the only contributor to - or - have permission from all contributors of the content item to change

It's wise to let the content creators set their own licenses. See the section "Notifying Contributors" on how to do this. For content you have permission to license, see the section "Updating content licenses"

Adding Licenses

Once you've upgraded to Kete 1.1, you can install some licenses that can be used when content is made. Firstly, find which licenses you want to add. Run the following in your applications root directory.

$ rake -D acts_as_licensed

This will list the available license types that can be installed. In this topic, we'll focus on the NZ CC licenses. Run the following to install them.

$ rake acts_as_licensed:import_nz_cc_licenses # you may want to add "RAILS_ENV=production" if appropriate 

Now start up your server, and carry onto the next step.

Setting the sites default license

The default license selected for new content when you install/upgrade to Kete 1.1 is the first one to be installed, which in the case of the NZ CC licenses is likely the CC Attribution-Noncommercial 3.0 NZ License. If this suits what you want, then skip this step. However if you'd like to switch to another license, it's quick and easy to do so.

  • Navigate to "Administrators Toolbox" > "reconfigure site" > "Advanced Options" > "Server" > "Default Content License"
  • Set the field to the id of the license you want to be the default. If you don't know it, follow these steps:
    • Open a console, and from your application root run "script/console production"
    • Type the following into the console, and find the license you want from the output, then memorize the id
      • License.all.each { |l| p "id: #{l.id}, name: #{l.name}"  }
  • Once filled in, click Save, and restart your application mongrel cluster.

And that's it. The default license is now changed. You can change it using the steps above as many times as you like.

Updating content licenses

If you have a lot of content on the site, that would take > 10 mins to update, then it's worth bulk updating it. It saves time, and works just as well. There are some simple commands you can run to do just this. Open a new console, load up "script/console production", and run the following commands (change only the first two lines to set which license and include usernames you have permission to update).

logins = ['admin']
new_license_id = 4
# dont change past here
logins.collect! { |login| user = User.find_by_login(login); (!user.nil? ? user.id : nil) }
['AudioRecording', 'Document', 'StillImage', 'Topic', 'Video', 'WebLink'].each { |type| Module.class_eval(type).find_all_by_license_id(nil).each { |t| t.license_id = new_license_id if logins.include?(t.creator.id); t.save_without_revision } }

Alternatively, you can do all existing records with a you database client program directly (in this case mysql) which is better suited for large amounts of records.  Like so:

$ mysql -u your_user -pyour_password your_database
> update audio_recordings set license_id = 1; # use the correct id of the license you want
> update documents set license_id = 1;
> update still_images set license_id = 1;
> update topics set license_id = 1;
> update videos set license_id = 1;
> update web_links set license_id = 1;
> exit

In the direct database case, you will also want to "rake tmp:cache:clear" and rebuild your search records, too.

And that's it. All content created by people in the logins array will now be set to the license id you specified.

Notifying contributors of licensing capability

As mentioned in the disclaimer, if you change licenses without permission, you will be violating copyright and may get into trouble. So rather than chaning them yourself, you can get permission from the content creators to bulk update it to their chosen license, or notify them that they can change the license themselves. To get a list of content creators, you can run the following in "script/console production" to get a list of emails you can paste into a CC or BCC field along with an email describing how to set licenses or to tell you what license they want. The content is up to you.

contribs_hash, contribs_list = {}, []
['AudioRecording', 'Document', 'StillImage', 'Topic', 'Video', 'WebLink'].each { |type| Module.class_eval(type).all.each { |t| contribs_hash[t.creator.id] = [(!t.creator.user_name.blank? ? t.creator.user_name : t.creator.login), t.creator.email] } }
contribs_hash.each { |c| contribs_list "#{c[1][0]} <#{c[1][1]}>" }
contribs_list.join(", ")

And that's it. Adding, setting default, updating content, and notifying contributors. If you have any questions please post them in the comment section below.

Discuss This Topic

There are 0 comments in this discussion.

join this discussion