Sha256: 89777cbd03755f1fdc60cc54e63b0d114792939d98ab5cfcbe65865f0ecff67c

Contents?: true

Size: 822 Bytes

Versions: 2

Compression:

Stored size: 822 Bytes

Contents

module Storytime
  class Permission < ActiveRecord::Base
    belongs_to :role
    belongs_to :action

    def self.seed
      writer = Role.find_by(name: "writer")
      editor = Role.find_by(name: "editor")
      admin  = Role.find_by(name: "admin")

      publish_own   = Action.find_by(guid: "5030ed")
      manage_others = Action.find_by(guid: "d8a1b1")
      manage_site   = Action.find_by(guid: "47342a")
      manage_users  = Action.find_by(guid: "1f7d47")

      create(role: writer, action: publish_own)
      create(role: editor, action: publish_own)
      create(role: admin, action: publish_own)

      create(role: editor, action: manage_others)
      create(role: admin, action: manage_others)

      create(role: admin, action: manage_site)
      create(role: admin, action: manage_users)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
storytime-0.0.4 app/models/storytime/permission.rb
storytime-0.0.2 app/models/storytime/permission.rb