ChangeRolePermissions() public method

public ChangeRolePermissions ( RoleInfo role ) : void
role RoleInfo
return void
示例#1
0
        internal string AddAzureNodeWorkerRoleProcess(string workerRoleName, int instances, string rootPath)
        {
            string result;
            AzureService service = new AzureService(rootPath, null);
            RoleInfo workerRole = service.AddWorkerRole(Resources.NodeScaffolding, workerRoleName, instances);
            try
            {
                service.ChangeRolePermissions(workerRole);
            }
            catch (UnauthorizedAccessException)
            {
                SafeWriteObject(Resources.AddRoleMessageInsufficientPermissions);
                SafeWriteObject(Environment.NewLine);
            }

            result = string.Format(Resources.AddRoleMessageCreate, rootPath, workerRole.Name);
            return result;
        }
示例#2
0
        public override void ExecuteCmdlet()
        {
            RootPath = RootPath ?? General.GetServiceRootPath(CurrentPath());
            AzureService service = new AzureService(RootPath, null);
            RoleInfo roleInfo = null;

            if (isWebRole)
            {
                roleInfo = service.AddWebRole(Scaffolding, Name, Instances);
            }
            else
            {
                roleInfo = service.AddWorkerRole(Scaffolding, Name, Instances);
            }

            OnProcessing(roleInfo);

            try
            {
                service.ChangeRolePermissions(roleInfo);
                SafeWriteOutputPSObject(typeof(RoleSettings).FullName, Parameters.RoleName, roleInfo.Name);
                WriteVerbose(string.Format(successMessage, RootPath, roleInfo.Name));
            }
            catch (UnauthorizedAccessException)
            {
                WriteWarning(Resources.AddRoleMessageInsufficientPermissions);
            }
        }