Beispiel #1
0
        /// <summary>
        ///   Gets an ancestor policy
        /// </summary>
        /// <param name = "policy">IPolicy</param>
        /// <returns>IPolicy</returns>
        public IPolicy GetAncestorPolicy(IPolicy policy)
        {
            try
            {
                if (_policies == null)
                {
                    BuildPolicyListing();
                }

                var parentOu = OuGateway.GetOuParentById(policy.GetOuId());

                if (parentOu == null)
                {
                    return(null);
                }

                for (var h = 0; h < _policies.Count; h++)
                {
                    if (_policies[h].GetOuId() == parentOu.GetOuId())
                    {
                        return(_policies[h]);
                    }
                }
            }
            catch (Exception error)
            {
                Framework.EventBus.Publish(error);
            }

            return(null);
        }
Beispiel #2
0
        /// <summary>
        ///   Gets an predecessor policy
        /// </summary>
        /// <param name = "policy">IPolicy</param>
        /// <returns>IPolicy</returns>
        public IPolicy GetPredecessorPolicy(IPolicy policy)
        {
            try
            {
                if (_policies == null)
                {
                    BuildPolicyListing();
                }

                var children = OuGateway.GetChildren(policy.GetOuId());

                if (children == null)
                {
                    return(null);
                }

                foreach (var iou in children)
                {
                    for (var h = 0; h < _policies.Count; h++)
                    {
                        if (_policies[h].GetOuId() == iou.GetOuId())
                        {
                            return(_policies[h]);
                        }
                    }
                }
            }
            catch (Exception error)
            {
                Framework.EventBus.Publish(error);
            }

            return(null);
        }