Example #1
0
        public override void RunPostConverter(Coveo.CES.Interops.COMCoveoConvertersWrappers.PostConversion p_PostConversion, Coveo.CES.Interops.COMCoveoConvertersWrappers.DocumentInfo p_DocumentInfo)
        {
            string contactemail = SafeGetFieldValue(p_DocumentInfo, "contactemail");

            if (!String.IsNullOrEmpty(contactemail))
            {
                p_DocumentInfo.Permissions.Clear();
                DocumentPermissionsEx   permissions = p_DocumentInfo.Permissions;
                DocumentPermissionLevel level       = permissions.AddPermissionLevel();
                DocumentPermissionSet   set         = level.AddPermissionSet();
                string[] email = contactemail.Split('@');
                set.Allowed.AddPermissionWithType(contactemail, PermissionTypeEnumeration.USER_PERMISSION_TYPE, "Email Security Provider");
                set.Allowed.AddPermissionWithType("*@" + email[1], PermissionTypeEnumeration.GROUP_PERMISSION_TYPE, "Email Security Provider");
            }
        }
Example #2
0
        public override void RunPostConverter(Coveo.CES.Interops.COMCoveoConvertersWrappers.PostConversion p_PostConversion, Coveo.CES.Interops.COMCoveoConvertersWrappers.DocumentInfo p_DocumentInfo)
        {
            string sqlConnection = p_PostConversion.GetParameter("sqlconnection");
            string projectNumber = SafeGetFieldValue(p_DocumentInfo, "ProjectNumber");

            using (IDbConnection cnnUsers = new SqlConnection(sqlConnection))
            {
                cnnUsers.Open();
                using (IDbCommand cmdUsers = cnnUsers.CreateCommand())
                {
                    cmdUsers.CommandText = "SELECT userName FROM ABC_ProjectMapping WHERE ProjectNumber ='" + projectNumber + "'";
                    using (IDataReader dbReader = cmdUsers.ExecuteReader())
                    {
                        while (dbReader.Read())
                        {
                            DocumentPermissionsEx   test  = p_DocumentInfo.Permissions;
                            DocumentPermissionLevel level = test.AddPermissionLevel();
                            DocumentPermissionSet   set   = level.AddPermissionSet();
                            set.Allowed.AddPermissionWithType(dbReader["userName"].ToString(), PermissionTypeEnumeration.USER_PERMISSION_TYPE, "salesforce regex");
                        }
                    }
                }
            }
        }