Repository URL to install this package:
|
Version:
6.1.1 ▾
|
# frozen_string_literal: true
require 'json'
module FacultyRBAC
# Data helper class for Grants
class Grant
attr_reader :id, :role_id, :group_id, :filter_args
def self.[](controller, row)
Grant.new controller, row[:id], row[:role_id], row[:group_id], row[:filter_args]
end
def initialize(controller, id, role, group, filter_args)
@controller = controller
@id = id.to_i
@role_id = role.to_i
@group_id = group.to_i
@filter_args = filter_args
end
def to_i
@id
end
def _db
@controller.db
end
def revoke
_db[:rbac_grant].where(id:).delete
end
end
end