Skip to end of banner
Go to start of banner

NCIP

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Steps to setting up MOD-NCIP


Step #1 - create a user with the required permissions

  • Create User (this example userid NCIP/ password Folio@2020)
  • Use the reset password link to create a password
  • The permissions for this user will have to be granted using API calls. They are not in the UX.  The last four on this list are actually part of the ncip.all set of permissions...but I think somewhere along the way module permissions might be missing from other modules & granting them to the NCIP user is a work-around.  I'm not entirely sure about this...something I need to look into.  At this point, the user needs to be granted all of these permissions.  I've included a python script I've been using to grant permissions (below).
        ncip.all
        inventory-storage.items.collection.get
        ui-circulation.settings.overdue-fines-policies
        ui-circulation.settings.lost-item-fees-policies
        automated-patron-blocks.collection.get

Step #2 - Decide on and set up configuration values.

When an NCIP request is sent, it should contain a 'fromAgency' value.  That value identifies who the request is from.  Mod-NCIP in FOLIO requires you to set up configuration values for EACH 'fromAgency' you will be accepting requests from.  This allows you to set up different configuration values for each 'agency' you are accepting NCIP requests from.  The values you have to decide on (per agency) are:

  • Instance type name:  Settings>Inventory>Instances>Resource Types  (When the AcceptItem service creates an instance, it will use this type)
  • Instance source: You can see this value on this Instance record under Source.  It doesn't have to be created in settings.  It appears to be a field you can put any value into.  (The AcceptItem service will use this value when it creates the instance)
  • Item material type name: Settings>Inventory>Items>Material Types  (The AcceptItem service will use this value when it creates the item)
  • Item loan type name: Settings>Inventory>Items>Loan Types (The AcceptItem service will use this value when it creates the item)
  • Item status name: I use Available (The AcceptItem service will use this value when it creates the item)
  • Item permanent location name:  Use a location from Settings>Tenant>Locations (The AcceptItem service will use this value when it creates the item) 
  • Holdings permanent location name: Use a location from Setting>Tenant>Locations (The AcceptItem service will use this value when it creates the holding record)
  • Instance custom identifier name: Settings>Instances>Resource Identifier Types
    Notes about this: When the 'AcceptItem' NCIP service is called, the FOLIO module creates an instance, holding and item record (and page request).  The request ID value is set as a Resource Identifier on the instance.  This makes searching for the request in the inventory module simple.  You can just use the request ID: 
  • Checkout service point code: Settings>tenants>service points (used when the NCIP Checkout service is called)
  • Checkin service point code: Settings>tenant>service points (used when the NCIP Checkin service is called)

    The next three configuration options have default values set within the NCIP module so they are optional:

  • Include patron's physical address in the LookupUser response.  (set to true or false - it defaults to false)
  • Lookup User response string to represent 'OK' to borrow - defaults to ACTIVE
  • Lookup User response string to represent 'NOT OK' to borrow - defaults to BLOCKED


When you have decided on and setup (where needed) these values in FOLIO you will have to make API calls to the configuration module to set the values the NCIP module will be looking for.  The script I've included assumes the value in 'fromAgency' of the requests will be ReShare.  The value 'ReShare' will be set as the 'configName' for each of the configuration values. The configuration values are also described in the README file in github.



setup configuration options python script:

import os.path
from git import *
import git, os, shutil
import shutil
import stat
import subprocess
from random import randrange
from pprint import pprint
import json
import sys
import requests
import psycopg2
import time
import urllib.request, json 
from collections import OrderedDict


url = "https://folio-snapshot-load-okapi.aws.indexdata.com"
tenant = "diku"

headers = {"x-okapi-tenant": tenant, "Content-type": "application/json"}

#AUTHENTICATE
user = {}
user['username'] = "diku_admin"
user['password'] = "redactedpassword"
user['tenant'] = tenant
the_data = json.dumps(user)
print(the_data)
response = requests.post(url + "/authn/login",the_data,headers=headers)
token = response.headers['x-okapi-token']
print(response)


#CODE--> configuration (e.g. instance type)
#CONFIGNAME --> AGENCY ID (E.G relais)
#MODULE --> NCIP

headers = {"x-okapi-tenant": tenant, "Content-type": "application/json","x-okapi-token":token}

configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "response.includes.physical.address"
configuration['value'] = "true"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)


configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "user.priv.ok.status"
configuration['value'] = "OK"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)

configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "user.priv.blocked.status"
configuration['value'] = "BLOCKED"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)


configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "instance.type.name"
configuration['value'] = "RESHARE"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)

configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "instance.source"
configuration['value'] = "RESHARE"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)

configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "item.material.type.name"
configuration['value'] = "RESHARE MATERIAL"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)

configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "item.perm.loan.type.name"
configuration['value'] = "RESHARE LOAN"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)

configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "item.status.name"
configuration['value'] = "Available"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)

configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "item.perm.location.code"
configuration['value'] = "RESHARE_DATALOGISK"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)

configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "holdings.perm.location.code"
configuration['value'] = "RESHARE_DATALOGISK"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)

configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "instance.custom.identifier.name"
configuration['value'] = "ReShare Request ID"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)

configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "checkout.service.point.code"
configuration['value'] = "Online"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)

configuration = {}
configuration['configName'] = "ReShare" #AGENCY ID
configuration['code'] = "checkin.service.point.code"
configuration['value'] = "Online"
configuration['module'] = "NCIP"
the_data = json.dumps(configuration)
print(the_data)
response = requests.post(url + "/configurations/entries",the_data,headers=headers)
print(response)













grant permissions python script:

import os.path
from git import *
import git, os, shutil
import shutil
import stat
import subprocess
from random import randrange
from pprint import pprint
import json
import sys
import requests
import psycopg2
import time
import urllib.request, json 
from collections import OrderedDict



url = "https://folio-snapshot-load-okapi.aws.indexdata.com"
tenant = "diku"


headers = {"x-okapi-tenant": tenant, "Content-type": "application/json"}

#AUTHENTICATE
user = {}
user['username'] = "diku_admin"
user['password'] = "redactedpassword"
user['tenant'] = tenant
the_data = json.dumps(user)
print(the_data)
response = requests.post(url + "/authn/login",the_data,headers=headers)
token = response.headers['x-okapi-token']
print(response)


headers = {"x-okapi-tenant": tenant, "Content-type": "application/json","x-okapi-token":token}


#PASTE THE UUID OF THE USER HERE:
theUserId = "ff247fa2-6113-4783-84f2-ea54af60424a"


jsonObject = {}
jsonObject['permissionName'] = 'ncip.all'
the_data = json.dumps(jsonObject)
print(the_data)
repsonse = requests.post(url + "/perms/users/" + theUserId + "/permissions?indexField=userId",the_data,headers=headers)
print(response)
print(response.content)


jsonObject = {}
jsonObject['permissionName'] = 'inventory-storage.items.collection.get'
the_data = json.dumps(jsonObject)
print(the_data)
repsonse = requests.post(url + "/perms/users/" + theUserId + "/permissions?indexField=userId",the_data,headers=headers)
print(response)
print(response.content)


jsonObject = {}
jsonObject['permissionName'] = 'ui-circulation.settings.overdue-fines-policies'
print(the_data)
repsonse = requests.post(url + "/perms/users/" + theUserId + "/permissions?indexField=userId",the_data,headers=headers)
print(response)
print(response.content)


jsonObject = {}
jsonObject['permissionName'] = 'ui-circulation.settings.lost-item-fees-policies'
the_data = json.dumps(jsonObject)
print(the_data)
repsonse = requests.post(url + "/perms/users/" + theUserId + "/permissions?indexField=userId",the_data,headers=headers)
print(response)
print(response.content)


jsonObject = {}
jsonObject['permissionName'] = 'automated-patron-blocks.collection.get'
the_data = json.dumps(jsonObject)
print(the_data)
repsonse = requests.post(url + "/perms/users/" + theUserId + "/permissions?indexField=userId",the_data,headers=headers)
print(response)
print(response.content)






  • No labels