Exemple #1
0
        // Change a named permission set.
        public NamedPermissionSet ChangeNamedPermissionSet
            (String name, PermissionSet pSet)
        {
            // Validate the parameters.
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (pSet == null)
            {
                throw new ArgumentNullException("pSet");
            }

            // Find the existing permission set with this name.
            NamedPermissionSet current = GetNamedPermissionSet(name);

            if (current == null)
            {
                throw new ArgumentException
                          (_("Security_PermissionSetNotFound"));
            }

            // Make a copy of the previous permission set.
            NamedPermissionSet prev =
                (NamedPermissionSet)(current.Copy());

            // Clear the permission set and recreate it from "pSet".
            current.CopyFrom(pSet);

            // Return the previsou permission set.
            return(prev);
        }