private void CreaStrutturaSuAzMan(string azManStorePath, int n) { this.Clessidra(true); this.StartTimer(); WindowsIdentity id = WindowsIdentity.GetCurrent(); NTAccount userName = new NTAccount(id.Name); IAzAuthorizationStore store = new AzAuthorizationStoreClass(); store.Initialize(0, azManStorePath, null); object o = null; this.pb.Maximum = n - 1; for (int a = 0; a < n; a++) { IAzApplication app = store.CreateApplication("Application" + a.ToString(), null); app.Submit(0, null); this.pb.Value = a; Application.DoEvents(); //IAzClientContext ctx = app.InitializeClientContextFromToken((UInt64)id.Token, null); for (int i = 0; i < n; i++) { IAzOperation op = app.CreateOperation("Operation" + i.ToString(), o); op.OperationID = i + 1; op.Submit(0, null); IAzTask task = app.CreateTask("Task" + i.ToString(), null); task.AddOperation(op.Name, null); task.Submit(0, null); IAzTask roleTask = app.CreateTask("Role" + i.ToString(), null); roleTask.IsRoleDefinition = 1; roleTask.AddTask("Task" + i.ToString(), null); roleTask.Submit(0, null); IAzRole role = app.CreateRole("Role" + i.ToString(), null); role.AddTask("Role" + i.ToString(), null); role.AddMember(id.User.Value, null); //add current user role.Submit(0, null); } } this.StopTimer(this.txtAzManElapsed); this.Clessidra(false); }
public IAzRole CreateRole(string name) => _scope != null?_scope.CreateRole(name) : _application.CreateRole(name);