1 # The Create/Read/Update/Delete permissions groups have
2 # on folders are stored in GroupPermissions
3 class GroupPermission < ActiveRecord::Base
7 # Create initial permissions.
8 # The admins group get permission on the Root folder.
9 # This method assumes the admins group exists and Root folder exists.
10 def self.create_initial_permissions
11 # Get the root folder and the admins group
12 root_folder = Folder.find_by_is_root(true)
13 admins_group = Group.find_by_is_the_administrators_group(true)
15 # Create the permissions
16 unless root_folder.blank? or admins_group.blank?
17 %w(admins frontpage folderadmins).each do |grpname|
18 group = GroupPermission.new
19 group.folder = root_folder
20 group.group = Group.find_by_name(grpname)
21 group.can_create = true
23 group.can_update = true
24 group.can_delete = true