September 14, 2009

Using the AzMan Helper Classes II

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here.

Here is the second post regarding the usage of these helper classes:
//Get list of operation names of the application
public string[] GetOperations(string storeUrl, string applicationName)
{
ArrayList operationNames = new ArrayList();

IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
foreach (IAzOperation operation in app.Operations)
{
operationNames.Add(operation.Name);
}

return (string[])operationNames.ToArray(typeof(string));
}

public void AddOperation(string storeUrl, string applicationName, string operationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
OperationHelper.AddOperation(app, operationName);
}

public void RemoveOperation(string storeUrl, string applicationName, string operationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
OperationHelper.RemoveOperation(app, operationName);
}

public bool IsOperationExists(string storeUrl, string applicationName, string operationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return OperationHelper.IsOperationExists(app, operationName);
}

public string[] GetRoles(string storeUrl, string applicationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return RoleHelper.GetRoleNames(app);
}

public void AddRole(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
RoleHelper.AddRole(app, roleName);
}

public void RemoveRole(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
RoleHelper.RemoveRole(app, roleName);
}

public bool IsRoleExists(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return RoleHelper.IsRoleExists(app, roleName);
}

No comments:

Post a Comment