Esempio n. 1
0
 public void PutAll(ConditionMap cmap)
 {
     foreach (var item in cmap)
     {
         this.Put(item.Key, item.Value);
     }
 }
Esempio n. 2
0
        /**
         * Appends given statement into statement list to have unique statements.
         * - If statement already exists in statement list, it ignores.
         * - If statement exists with different conditions, they are merged.
         * - Else the statement is appended to statement list.
         */
        private void appendStatement(Statement statement)
        {
            foreach (Statement s in statements)
            {
                IList <string> aws        = s.principal.aws();
                ConditionMap   conditions = s.conditions;

                if ((utils.isSupersetOf(s.actions, statement.actions) &&
                     s.effect.Equals(statement.effect) &&
                     aws != null && (utils.isSupersetOf(aws, statement.principal.aws())) &&
                     conditions != null && conditions.Equals(statement.conditions)))
                {
                    s.resources.UnionWith(statement.resources);
                    return;
                }

                if (s.resources.IsSupersetOf(statement.resources) &&
                    s.effect.Equals(statement.effect) &&
                    aws != null && (utils.isSupersetOf(aws, statement.principal.aws())) &&
                    conditions != null && conditions.Equals(statement.conditions))
                {
                    s.actions.Union(statement.actions);
                    return;
                }

                if (s.resources.IsSupersetOf(statement.resources) &&
                    (utils.isSupersetOf(s.actions, statement.actions) &&
                     s.effect.Equals(statement.effect) &&
                     aws != null && utils.isSupersetOf(aws, statement.principal.aws())))
                {
                    if (conditions != null && conditions.Equals(statement.conditions))
                    {
                        return;
                    }

                    if (conditions != null && statement.conditions != null)
                    {
                        conditions.PutAll(statement.conditions);
                        return;
                    }
                }
            }
            if (statement.actions != null && statement.resources != null && statement.actions.Count() != 0 && statement.resources.Count() != 0)
            {
                statements.Add(statement);
            }
        }
Esempio n. 3
0
 public ConditionMap(ConditionMap map = null) : base(map)
 {
 }