internal static SetterDelegate ScopeTypeSetterDelegate(ScopeLocation scopeLocation) { return(delegate(object value, IPropertyBag propertyBag) { RoleFlagsFormat.SetScopeBits((uint)((ScopeType)value), propertyBag, scopeLocation); }); }
public override bool?TryIsInRole(ExchangeRunspaceConfiguration rbacConfiguration) { ADRawEntry adrawEntry = this.TargetObject ?? (RbacQuery.LegacyTargetObject as ADRawEntry); if (adrawEntry != null && !(adrawEntry is ADConfigurationObject) && !(adrawEntry is OrganizationConfig)) { ScopeLocation scopeLocation = this.CmdletName.StartsWith("get-", StringComparison.OrdinalIgnoreCase) ? ScopeLocation.RecipientRead : ScopeLocation.RecipientWrite; return(new bool?(rbacConfiguration.IsCmdletAllowedInScope(this.CmdletName, this.ParameterNames ?? new string[0], adrawEntry, scopeLocation))); } return(new bool?(rbacConfiguration.IsCmdletAllowedInScope(this.QualifiedCmdletName, this.ParameterNames, this.ScopeSet))); }
/// <summary> /// Devuelve informacion asociada al tipo /// </summary> /// <param name="typeId"></param> /// <returns></returns> public TypeInfo GetTypeInfo(string typeId) { ScopeLocation sl = HasType(typeId); if (sl == ScopeLocation.NotDeclared) { throw new ArgumentException("El tipo no esta declarado"); } if (sl == ScopeLocation.DeclaredLocal) { return(types[typeId]); } return(Parent.GetTypeInfo(typeId)); }
public TScope this[ScopeLocation scopeLocation] { get { switch (scopeLocation) { case ScopeLocation.RecipientRead: return(this.recipientReadScope); case ScopeLocation.RecipientWrite: return(this.recipientWriteScope); case ScopeLocation.ConfigRead: return(this.configReadScope); case ScopeLocation.ConfigWrite: return(this.configWriteScope); default: throw new ArgumentException("scopeLocation"); } } }
public override bool VisitVarDeclaration(VarDeclarationAST expr) { expr.CurrentScope = _scope; ScopeLocation idLocation = _scope.HasVar(expr.Id); if (idLocation == ScopeLocation.DeclaredLocal) { _errorListener.Add(new AnalysisError(string.Format(AnalysisError.LoadMessage("VarDecl"), expr.Id), expr.Line, expr.Columns)); expr.ReturnType = TigerType.GetType <ErrorType>(); return(false); } if (idLocation != ScopeLocation.NotDeclared) { _errorListener.Add(AnalysisError.VariableHidesAnotherOne(expr)); } //TODO: Rename ExpressionValue to NamedExpression expr.ExpressionValue.Accept(this); //se asume q no habran problemas de compatibilidad expr.ReturnType = TigerType.GetType <NoType>(); // si se expecifico de forma explicita el tipo de la variable... if (!string.IsNullOrEmpty(expr.TypeId)) { TigerType tt; //existe el tipo if (_scope.HasType(expr.TypeId, out tt) != ScopeLocation.NotDeclared) { //el tipo de la variable no machea con el de la expression if (!expr.ExpressionValue.ReturnType.CanConvertTo(tt)) { _errorListener.Add( new AnalysisError( string.Format(AnalysisError.LoadMessage("Match"), expr.TypeId, expr.ExpressionValue.ReturnType.TypeID), expr.Line, expr.Columns)); expr.ReturnType = TigerType.GetType <ErrorType>(); _scope.AddVar(expr.Id, TigerType.GetType <ErrorType>().TypeID); return(false); } expr.ReturnType = expr.ExpressionValue.ReturnType; //si me especifica el tipo explicitamente . _scope.AddVar(expr.Id, tt.TypeID); return(true); } // no existe el tipo de la variable _errorListener.Add(AnalysisError.TypeIsNotDefined(expr, expr.TypeId)); expr.ReturnType = TigerType.GetType <ErrorType>(); _scope.AddVar(expr.Id, TigerType.GetType <ErrorType>().TypeID); return(false); } if (!expr.ExpressionValue.ReturnType.IsLegalType) { _errorListener.Add(AnalysisError.TypeCannotBeInferred(expr, expr.Id)); expr.ReturnType = TigerType.GetType <ErrorType>(); _scope.AddVar(expr.Id, TigerType.GetType <ErrorType>().TypeID); return(false); } _scope.AddVar(expr.Id, expr.ExpressionValue.ReturnType.TypeID); return(true); }
internal static GetterDelegate ScopeTypeGetterDelegate(ScopeLocation scopeLocation) { return((IPropertyBag propertyBag) => (ScopeType)RoleFlagsFormat.GetScopeBits(propertyBag, scopeLocation)); }
private static void SetScopeBits(uint valueToSet, IPropertyBag propertyBag, ScopeLocation scopeLocation) { int num = (int)propertyBag[ExchangeRoleSchema.RoleFlags]; propertyBag[ExchangeRoleSchema.RoleFlags] = (int)(((ulong)num & (ulong)(~(31L << (RoleFlagsFormat.ScopeShifts[(int)scopeLocation] & 31)))) | (ulong)((ulong)(valueToSet & 31U) << RoleFlagsFormat.ScopeShifts[(int)scopeLocation])); }
private static uint GetScopeBits(IPropertyBag propertyBag, ScopeLocation scopeLocation) { int num = (int)propertyBag[ExchangeRoleSchema.RoleFlags]; return((uint)num >> RoleFlagsFormat.ScopeShifts[(int)scopeLocation] & 31U); }