Click or drag to resize

IGetAuthorizationInfo Interface

Provides the methods to check if the user is authorized.

Namespace:  AGI.Parallel.Client
Assembly:  AGI.Parallel.Client (in AGI.Parallel.Client.dll) Version: 2.9.0.1601 (2.9.0.1601)
Syntax
public interface IGetAuthorizationInfo

The IGetAuthorizationInfo type exposes the following members.

Methods
  NameDescription
Public methodCode exampleGetUserAuthorization
Determines whether the user is authorized for the job submission protocol.
Top
Examples
using System;
using AGI.Parallel.Client;
using AGI.Parallel.Infrastructure;

namespace CodeSamples
{
    class Program
    {
        static void Main(string[] args)
        {
            using (IJobScheduler scheduler = new ClusterJobScheduler("localhost"))
            {
                scheduler.Connect();

                IGetAuthorizationInfo asGetAuthorizationInfo = scheduler as IGetAuthorizationInfo;
                if (asGetAuthorizationInfo != null)
                {
                    Console.WriteLine("Current User: " + System.Security.Principal.WindowsIdentity.GetCurrent().Name);
                    AuthorizationType authorization = asGetAuthorizationInfo.GetUserAuthorization();
                    if (authorization == AuthorizationType.AccessAllowed)
                    {
                        Console.WriteLine("Allowed to submit tasks");
                    }
                    else
                    {
                        Console.WriteLine("NOT Allowed to submit tasks");
                    }
                }
            }

            /*
             * The output of the application should resemble:
             * Current User: AGI\hdinh
             * Allowed to submit tasks
             */
        }
    }
}
See Also

STK Parallel Computing Server 2.9 API for .NET