Sha256: be7c5db7dc83f5ca5a9dbd5a4bba4730ef3be1c357f66636e5154b5dfb97d3fc

Contents?: true

Size: 1.55 KB

Versions: 12

Compression:

Stored size: 1.55 KB

Contents

module RocketJobMissionControl
  class AccessPolicy
    include AccessGranted::Policy

    def configure
      # Destroy Jobs, Dirmon Entries
      role :admin, {admin: true} do
        can %i[create destroy], RocketJob::Job
        can :destroy, RocketJob::DirmonEntry
      end

      # View the contents of jobs and edit the data within them.
      # Including encrypted records.
      role :editor, {editor: true} do
        can %i[view_slice edit_slice update_slice], RocketJob::Job
      end

      # Stop, Pause, Resume, Destroy (force stop) Rocket Job Servers
      role :operator, {operator: true} do
        can %i[stop kill pause resume destroy destroy_zombies thread_dump], RocketJob::Server
      end

      # Pause, Resume, Retry, Abort, Edit Jobs
      role :manager, {manager: true} do
        can %i[edit pause resume retry abort fail update run_now], RocketJob::Job
      end

      # Create, Destroy, Enable, Disable, Edit, Copy, Replicate Dirmon Entries
      role :dirmon, {dirmon: true} do
        can %i[create enable disable update edit copy replicate], RocketJob::DirmonEntry
      end

      # A User can only edit their own jobs
      role :user, {user: true} do
        can %i[edit pause resume retry abort update], RocketJob::Job do |job, auth|
          job.respond_to?(:login) && (job.login == auth.login)
        end
      end

      # Read only access
      role :view do
        can :read, RocketJob::Job
        can :read, RocketJob::DirmonEntry
        can :read, RocketJob::Server
        can :read, RocketJob::Worker
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rocketjob_mission_control-6.1.0 app/models/rocket_job_mission_control/access_policy.rb
rocketjob_mission_control-6.0.7 app/models/rocket_job_mission_control/access_policy.rb
rocketjob_mission_control-6.0.6 app/models/rocket_job_mission_control/access_policy.rb
rocketjob_mission_control-6.0.5 app/models/rocket_job_mission_control/access_policy.rb
rocketjob_mission_control-6.0.4 app/models/rocket_job_mission_control/access_policy.rb
rocketjob_mission_control-6.0.3 app/models/rocket_job_mission_control/access_policy.rb
rocketjob_mission_control-6.0.2 app/models/rocket_job_mission_control/access_policy.rb
rocketjob_mission_control-6.0.1 app/models/rocket_job_mission_control/access_policy.rb
rocketjob_mission_control-6.0.0 app/models/rocket_job_mission_control/access_policy.rb
rocketjob_mission_control-6.0.0.beta app/models/rocket_job_mission_control/access_policy.rb
rocketjob_mission_control-5.0.1 app/models/rocket_job_mission_control/access_policy.rb
rocketjob_mission_control-5.0.0 app/models/rocket_job_mission_control/access_policy.rb