private bool?CheckRbacForNotAccessPermission(DataRow input, DataTable dataTable, DataObjectStore store, Variable variable, IEnumerable <Workflow> sets) { bool?flag = null; Collection <Activity> activities = base.Activities; bool hasDataObject = !string.IsNullOrWhiteSpace(variable.DataObjectName); foreach (Activity activity in activities) { flag = flag.Or(activity.FindAndCheckPermission((Activity a) => (hasDataObject && a is GetCmdlet && (a as GetCmdlet).DataObjectName == variable.DataObjectName) || a.HasOutputVariable(variable.Name), input, dataTable, store, variable)); if (flag.IsTrue()) { break; } } if (hasDataObject) { IVersionable versionable = store.GetDataObject(variable.DataObjectName) as IVersionable; if (versionable != null && versionable.ExchangeVersion != null) { PropertyDefinition propertyDefinition = versionable.ObjectSchema[variable.MappingProperty]; if (propertyDefinition != null && !versionable.IsPropertyAccessible(propertyDefinition)) { flag = new bool?(false); } } } return(flag); }
internal static void ApplyRolesFilterRecursive(Control c, IPrincipal currentUser, IVersionable versionableObject) { IAttributeAccessor attributeAccessor = c as IAttributeAccessor; if (attributeAccessor != null) { string attribute = attributeAccessor.GetAttribute("SetRoles"); string attribute2 = attributeAccessor.GetAttribute("DataBoundProperty"); PropertyDefinition propertyDefinition = (versionableObject != null && !string.IsNullOrEmpty(attribute2)) ? versionableObject.ObjectSchema[attribute2] : null; if (propertyDefinition != null && !versionableObject.IsPropertyAccessible(propertyDefinition)) { Properties.HideControl(c, Properties.FindAssociatedLabel(c)); } else if ((!string.IsNullOrEmpty(attribute) && !LoginUtil.IsInRoles(currentUser, attribute.Split(new char[] { ',' }))) || (!string.IsNullOrEmpty(attribute2) && versionableObject != null && versionableObject.IsReadOnly)) { string attribute3 = attributeAccessor.GetAttribute("NoRoleState"); Label associatedLabel = Properties.FindAssociatedLabel(c); if (!string.IsNullOrEmpty(attribute3) && NoRoleState.Hide == (NoRoleState)Enum.Parse(typeof(NoRoleState), attribute3)) { Properties.HideControl(c, associatedLabel); } else { Properties.MakeControlRbacDisabled(c, associatedLabel); if (!string.IsNullOrEmpty(attributeAccessor.GetAttribute("helpId"))) { attributeAccessor.SetAttribute("helpId", string.Empty); } attributeAccessor.SetAttribute("MandatoryParam", null); } } } if (c.HasControls()) { foreach (object obj in c.Controls) { Control c2 = (Control)obj; Properties.ApplyRolesFilterRecursive(c2, currentUser, versionableObject); } } }