Esempio n. 1
0
        public void ModifyTableRights(SuperOffice.CRM.Security.TableRights rights)
        {
            if (!Constants.EnableSale)
            {
                return;
            }

            _rightsManager.SignalEvent(Constants.SentryName.DevNet, Constants.SentryEntities.Sale, SentryState.BeforeModified, rights);
        }
Esempio n. 2
0
        /// <summary>
        /// Modify rights associated with specified tables.
        /// </summary>
        /// <param name="rights">Rights object to modify.</param>
        /// <remarks>Use this method to change rights across related blocks of information, i.e. table-wide rights.</remarks>
        public void ModifyTableRights(SuperOffice.CRM.Security.TableRights rights)
        {
            if (!Constants.EnableContact)
            {
                _rightsManager.SignalEvent(Constants.SentryName.DevNet, Constants.SentryEntities.Contact, "Contact sentry not enabled!");
                return;
            }

            try
            {
                _rightsManager.SignalEvent(Constants.SentryName.DevNet, Constants.SentryEntities.Contact, SentryState.BeforeModified, rights);

                string department = GetFieldValue(QueryInfo.MainTable.Department) as string;
                if (!string.IsNullOrEmpty(department) && department.Trim().EndsWith("_") && _sentry.GetRecordOwnershipIndex() != EOwnershipIndex.Owner)
                {
                    _rightsManager.SignalEvent(Constants.SentryName.DevNet, Constants.SentryEntities.Contact, "Updating Contact!");

                    _sunIsNotShining = true;
                    TableRights newRights = new TableRights();
                    foreach (TableInfo ti in rights.Keys)
                    {
                        newRights[ti] = rights[ti] & RightsFactory.Get(ETableRight.R, "The sun is not shining on trailing '_'");
                    }

                    foreach (TableInfo ti in newRights.Keys)
                    {
                        rights[ti] = newRights[ti];
                    }
                }
                else
                {
                    _sunIsNotShining = false;
                }

                _rightsManager.SignalEvent(Constants.SentryName.DevNet, Constants.SentryEntities.Contact, SentryState.AfterModified, rights);
            }
            catch (Exception e)
            {
                _rightsManager.SignalEvent(Constants.SentryName.DevNet, Constants.SentryEntities.Contact, e.GetBaseException().Message);
                throw;
            }
        }