Exemplo n.º 1
0
        /// <summary>
        /// Gets the protection domain contract for the specified protection domain
        /// id and assigns the role ids passed as argument to the contract.
        /// <p>
        /// Calls the UpdateProtectionDomain method on an instance of the InfoShareService.CommonClient
        /// class and passes the connection id of the administrator, and the
        /// protection domain contract as arguments.
        /// </summary>
        /// <param name="connAdminUserID">the connection id of the administrator</param>
        /// <param name="roleIDs">an array of role ids</param>
        /// <param name="protectionDomainID">the protection domain id</param>
        public void AssignRolesToProtectionDomain(string connAdminUserID, string[] roleIDs, string protectionDomainID)
        {
            ProtectionDomainContract protDomainContract = GetProtectionDomainContract(protectionDomainID);

            protDomainContract.RoleIds = roleIDs;

            CommonClient.UpdateProtectionDomain(connAdminUserID, protDomainContract);
            this.RefreshSecurityStore(connAdminUserID);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a protection domain contract and sets a mandatory field on the contract.
        ///
        /// The name of the protection domain contract is passed as an argument.
        /// Calls the CreateProtectionDomain method on an instance of the InfoShareService.CommonClient
        /// class and passes the connection id of the administrator, and the
        /// contract as arguments.
        /// </summary>
        /// <param name="connAdminUserID">the connection id of the administrator</param>
        /// <param name="protectionDomainName">the protection domain name</param>
        /// <param name="schemaCulture">the schema culture</param>
        /// <returns>the id of the created protection domain</returns>
        public string CreateProtectionDomain(string connAdminUserID, string protectionDomainName, string schemaCulture)
        {
            StringGlobalContract strGlobalContract = Utility.ConvertStringToStringGlobalContract(protectionDomainName, schemaCulture);

            ProtectionDomainContract protDomainContract = new ProtectionDomainContract
            {
                // Sets mandatory field
                Name = strGlobalContract
            };

            string protectionDomainID = CommonClient.CreateProtectionDomain(connAdminUserID, protDomainContract);

            this.RefreshSecurityStore(connAdminUserID);

            return(protectionDomainID);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets the protection domain contract for the specified protection domain id.
        ///
        /// Gets an array of protection domain contracts from the security store that
        /// is passed as an argument and searches for the protection domain contract
        /// with the specified protection domain id. Returns the protection domain contract,
        /// if it finds the contract.
        /// </summary>
        /// <param name="securityStore">the security store</param>
        /// <param name="protectionDomainID">the protection domain id</param>
        /// <returns>the protection domain contract</returns>
        private ProtectionDomainContract GetProtectionDomainContract(string protectionDomainID)
        {
            ProtectionDomainContract protDomainContract = null;

            // Searches for the protection domain contract with the specified protection domain id
            foreach (ProtectionDomainContract protectionDomain in this.SecurityStore.ProtectionDomains)
            {
                if (protectionDomain.Id == protectionDomainID)
                {
                    // Contract found
                    protDomainContract = protectionDomain;
                    break;
                }
            }
            if (protDomainContract == null)
            {
                throw new NotFoundException("No protection domain contract found for protection domain ID <" + protectionDomainID + ">.");
            }

            return(protDomainContract);
        }