internal IAzScope CreateScope(string name, string description = null) { var iaz = IAzScope.CreateScope(name); iaz.Description = description; iaz.Submit(); return(iaz); }
internal IAzApplicationGroup CreateGroup(string name, string description = null) { var iaz = IAzScope.CreateApplicationGroup(name); iaz.Description = description; iaz.Submit(); return(iaz); }
internal void DeleteOperation(AzOperation operation) { if (operation == null) { return; } Operations.Remove(operation); IAzScope.DeleteOperation(operation.Name); HasChanged = true; }
internal void DeleteRoleAssignment(AzRoleAssignment roleAssignment) { if (roleAssignment == null) { return; } RoleAssignments.Remove(roleAssignment); IAzScope.DeleteRole(roleAssignment.Name); HasChanged = true; }
internal IAzTask CreateRole(string name, string description = null) { var iaz = IAzScope.CreateTask(name); iaz.IsRoleDefinition = 1; iaz.Description = description; iaz.Submit(); return(iaz); }
internal void DeleteGroup(AzGroup group) { if (group == null) { return; } Groups.Remove(group); IAzScope.DeleteApplicationGroup(group.Name); HasChanged = true; }
internal void DeleteRole(AzRole role) { if (role == null) { return; } Roles.Remove(role); IAzScope.DeleteTask(role.Name); HasChanged = true; }
internal void DeleteScope(AzScope scope) { if (scope == null) { return; } Scopes.Remove(scope); IAzScope.DeleteScope(scope.Name); HasChanged = true; }
private void SetHirearchy(IAzScope azScope, IAzApplication azApplication, string taskName, IAzManApplication application) { IAzTask azTask = null; if (azScope == null) { azTask = azApplication.OpenTask(taskName, null); } else { azTask = azScope.OpenTask(taskName, null); } if (azTask != null) { IAzManItem item = application.GetItem(taskName); //SubTasks object[] azSubTasks = azTask.Tasks as object[]; if (azSubTasks != null) { foreach (string azSubTask in azSubTasks) { IAzManItem subItem = application.GetItem(azSubTask); var members = item.GetMembers(); if (members == null || members.Where(t => t.ItemId == subItem.ItemId).Count() == 0) { item.AddMember(subItem); } this.SetHirearchy(azScope, azApplication, azSubTask, application); } } //SubOperations object[] azSubOperations = azTask.Operations as object[]; if (azSubOperations != null) { foreach (string azSubOperation in azSubOperations) { IAzManItem subItem = application.GetItem(azSubOperation); var members = item.GetMembers(); if (members == null || members.Where(t => t.ItemId == subItem.ItemId).Count() == 0) { item.AddMember(subItem); } } } } }
protected override void OnSaving() { if (IsNew) { IAzItem = Application.CreateScope(Name, Description); } else { IAzScope.Name = Name; IAzScope.Description = Description; } Roles.ForEach(r => r.Save()); Groups.ForEach(g => g.Save()); RoleAssignments.ForEach(r => r.Save()); IAzScope.Submit(); }
private object[] GetTaskOperations(AzManAuthorizationProviderData data, IAzApplication azApp, string[] tasks) { string[] scopes = new string[] { data.Scope }; StringCollection operations = new StringCollection(); foreach (String task in tasks) { IAzScope scope = null; if ((scopes != null) && (scopes[0].Length > 0)) { scope = azApp.OpenScope(scopes[0], null); } IAzTask azTask = null; if (scope != null) { azTask = scope.OpenTask(task, null); } else { azTask = azApp.OpenTask(task, null); } Array ops = azTask.Operations as Array; Debug.Assert(ops != null); foreach (String op in ops) { operations.Add(op); } } if (operations.Count == 0) { throw new ConfigurationException(SR.NoOperations); } object[] operationIds = new object[operations.Count]; for (int index = 0; index < operations.Count; index++) { operationIds[index] = azApp.OpenOperation(operations[index], null).OperationID; } return(operationIds); }
private object[] GetTaskOperations(IAzApplication azApp, string[] tasks) { string[] scopes = new string[] { this.scopeName }; StringCollection operations = new StringCollection(); foreach (String task in tasks) { IAzScope scope = null; if ((scopes != null) && (scopes[0].Length > 0)) { scope = azApp.OpenScope(scopes[0], null); } IAzTask azTask = null; if (scope != null) { azTask = scope.OpenTask(task, null); } else { azTask = azApp.OpenTask(task, null); } Array ops = azTask.Operations as Array; foreach (String op in ops) { operations.Add(op); } } if (operations.Count == 0) { throw new ConfigurationErrorsException(Properties.Resources.NoOperations); } object[] operationIds = new object[operations.Count]; for (int index = 0; index < operations.Count; index++) { operationIds[index] = azApp.OpenOperation(operations[index], null).OperationID; } return(operationIds); }
internal AzRoleAssignment GetOrCreateAzRoleAssignment(string name) { var role = RoleAssignments[name]; if (role != null) { return(role); } var azRole = IAzScope.CreateRole(name); azRole.Submit(); role = new AzRoleAssignment { IAzItem = azRole }; RoleAssignments.Add(role); HasChanged = true; return(role); }
private void SetHirearchy(IAzScope azScope, IAzApplication azApplication, string taskName, IAzManApplication application) { IAzTask azTask = null; if (azScope == null) { azTask = azApplication.OpenTask(taskName, null); } else { azTask = azScope.OpenTask(taskName, null); } IAzManItem item = application.GetItem(taskName); if (azTask != null) { //SubTasks object[] azSubTasks = azTask.Tasks as object[]; if (azSubTasks != null) { foreach (string azSubTask in azSubTasks) { IAzManItem subItem = application.GetItem(azSubTask); item.AddMember(subItem); //this.SetHirearchy(azScope, azApplication, azSubTask, application); } } //SubOperations object[] azSubOperations = azTask.Operations as object[]; if (azSubOperations != null) { foreach (string azSubOperation in azSubOperations) { IAzManItem subItem = application.GetItem(azSubOperation); item.AddMember(subItem); } } } }
private void SetHirearchy(IAzScope azScope, IAzApplication azApplication, string taskName, IAzManApplication application) { IAzTask azTask = null; if (azScope == null) azTask = azApplication.OpenTask(taskName, null); else azTask = azScope.OpenTask(taskName, null); IAzManItem item = application.GetItem(taskName); if (azTask != null) { //SubTasks object[] azSubTasks = azTask.Tasks as object[]; if (azSubTasks != null) { foreach (string azSubTask in azSubTasks) { IAzManItem subItem = application.GetItem(azSubTask); item.AddMember(subItem); //this.SetHirearchy(azScope, azApplication, azSubTask, application); } } //SubOperations object[] azSubOperations = azTask.Operations as object[]; if (azSubOperations != null) { foreach (string azSubOperation in azSubOperations) { IAzManItem subItem = application.GetItem(azSubOperation); item.AddMember(subItem); } } } }
public AzApplicationScopeWrapper(IAzScope scope) { Guard.ArgumentIsNotNull(scope, nameof(scope)); _scope = scope; }
private void SetHirearchy(IAzScope azScope, IAzApplication azApplication, string taskName, IAzManApplication application) { IAzTask azTask = null; if (azScope == null) azTask = azApplication.OpenTask(taskName, null); else azTask = azScope.OpenTask(taskName, null); if (azTask != null) { IAzManItem item = application.GetItem(taskName); //SubTasks object[] azSubTasks = azTask.Tasks as object[]; if (azSubTasks != null) { foreach (string azSubTask in azSubTasks) { IAzManItem subItem = application.GetItem(azSubTask); var members = item.GetMembers(); if (members == null || members.Where(t => t.ItemId == subItem.ItemId).Count() == 0) item.AddMember(subItem); this.SetHirearchy(azScope, azApplication, azSubTask, application); } } //SubOperations object[] azSubOperations = azTask.Operations as object[]; if (azSubOperations != null) { foreach (string azSubOperation in azSubOperations) { IAzManItem subItem = application.GetItem(azSubOperation); var members = item.GetMembers(); if (members == null || members.Where(t => t.ItemId == subItem.ItemId).Count() == 0) item.AddMember(subItem); } } } }