lib/workflow_setup.rb
# Read a config file to figure out what workflow to enable and how to grant approving_role
# @param [String] admin_set_title
# @return [AdminSet]
Read a config file to figure out what workflow to enable and how to grant approving_role
Read a config file to figure out what workflow to enable and how to grant approving_role
def make_admin_set_from_config(admin_set_title)
    config = admin_set_config(admin_set_title)
    config["workflow"] || config["workflow"] = "emory_one_step_approval"
    admin_set = make_mediated_deposit_admin_set(admin_set_title, config["workflow"])
    approving_users = []
    config["approving"].each do |approver_uid|
      u = ::User.find_or_create_by(uid: approver_uid)
      u.password = "123456" if set_default_password?
      u.provider = "shibboleth"
      u.ppid = approver_uid 
      u.save
      approving_users << u.to_sipity_agent
    end
    approval_role = Sipity::Role.find_by!(name: 'approving')
    workflow = admin_set.active_workflow
    workflow.update_responsibilities(role: approval_role, agents: (approving_users.concat users_in_role(admin_set, "approving")))
    if workflow.workflow_roles.map { |workflow_role| workflow_role.role.name }.include?("reviewing")
      reviewing_role = Sipity::Role.find_by!(name: 'reviewing')
      workflow.update_responsibilities(role: reviewing_role, agents: (approving_users.concat users_in_role(admin_set, "reviewing")))
    end
    admin_set
  end
def make_admin_set_from_config ( admin_set_title ) config = admin_set_config ( admin_set_title ) config [ "workflow" ] || config [ "workflow" ] = "emory_one_step_approval" admin_set = make_mediated_deposit_admin_set ( admin_set_title , config [ "workflow" ] ) approving_users = [ ] config [ "approving" ] . each do | approver_uid | u = :: User . find_or_create_by ( uid : approver_uid ) u . password = "123456" if set_default_password? u . provider = "shibboleth" u . ppid = approver_uid u . save approving_users << u . to_sipity_agent end approval_role = Sipity :: Role . find_by! ( name : 'approving' ) workflow = admin_set . active_workflow workflow . update_responsibilities ( role : approval_role , agents : ( approving_users . concat users_in_role ( admin_set , "approving" ) ) ) if workflow . workflow_roles . map { | workflow_role | workflow_role . role . name } . include? ( "reviewing" ) reviewing_role = Sipity :: Role . find_by! ( name : 'reviewing' ) workflow . update_responsibilities ( role : reviewing_role , agents : ( approving_users . concat users_in_role ( admin_set , "reviewing" ) ) ) end admin_set end
Read a config file to figure out what workflow to enable and how to grant approving_role
Read a config file to figure out what workflow to enable and how to grant approving_role
# temporary ppid, will get replaced when user signs in with shibboleth
None
AdminSet
admin_set_title
<not_specific>
<not_specific>
None