User Security Check in RIDC call for Specific Content


IdcClientManager m_clientManager = new IdcClientManager ();
IdcClient m_client = m_clientManager.createClient("<Your Hostname : Port>/cs/idcplg");

//RIDC superuser context
IdcContext m_superuser = new IdcContext("sysadmin", "idc");

//Examples of the three concrete cache classes
IUserSecurityCache m_SGCache = new UserSecurityGroupsCache (m_client, 20, 1000);
IUserSecurityCache m_SGAcctCache = new UserSGAccountsCache (m_client, 20, 1000, 20000);
IUserSecurityCache m_SGAcctAclCache = new UserSGAcctAclCache(m_client, 20, 1000, 20000, m_superuser);
DataBinder dataBinder = m_client.createBinder ();
dataBinder.putLocal ("IdcService", "DOC_INFO");
dataBinder.putLocal ("dID", "<dID of Specific Content>");
ServiceResponse response1 = m_client.sendRequest(m_superuser, dataBinder);
dataBinder = response1.getResponseAsBinder();

//Get the document information (typically in the first row of DOC_INFO)
DataObject docInfo = dataBinder.getResultSet ("DOC_INFO").getRows ().get (0);
IdcContext context = new IdcContext(<User Name for Whom to Check Access>,<Correct Password>);
CacheId ccID= new CacheId (context.getUser (), context);

//Get the access level for this document by this user
int access = m_SGAcctAclCache.getAccessLevelForDocument (ccID, docInfo);

//access level in Content Server form (1=Read, 3=Write, 7=Delete)

 

Here if access returns 1 then user have Read Access

if 3 user have Write Access
If 7 user have Delete Access