Exemplo n.º 1
0
 public virtual bool IsAllowedClone(Net.Vpc.Upa.Entity entity, object instance, object newId) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.EntitySecurityManager s = entity.GetEntitySecurityManager();
     if (s != null)
     {
         return(s.IsAllowedClone(entity, instance, newId));
     }
     return(IsAllowedKey(entity, "Clone"));
 }
Exemplo n.º 2
0
 public virtual bool IsAllowedUpdate(Net.Vpc.Upa.Entity entity, object id, object @value) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.EntitySecurityManager s = entity.GetEntitySecurityManager();
     if (s != null)
     {
         return(s.IsAllowedUpdate(entity, id, @value));
     }
     return(IsAllowedKey(entity, "Update"));
 }
Exemplo n.º 3
0
 public virtual bool IsAllowedRemove(Net.Vpc.Upa.Entity entity, object id) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.EntitySecurityManager s = entity.GetEntitySecurityManager();
     if (s != null)
     {
         return(s.IsAllowedRemove(entity, id, null));
     }
     return(IsAllowedKey(entity, "Delete"));
 }
Exemplo n.º 4
0
        /**
         *
         * @param entity
         * @return
         * @throws UPAException
         */

        public virtual Net.Vpc.Upa.Expressions.Expression GetEntityFilter(Net.Vpc.Upa.Entity entity) /* throws Net.Vpc.Upa.Exceptions.UPAException */
        {
            Net.Vpc.Upa.EntitySecurityManager s = entity.GetEntitySecurityManager();
            if (s != null)
            {
                return(s.GetEntityFilter(entity));
            }
            return(null);
        }
Exemplo n.º 5
0
 public virtual bool IsAllowedPersist(Net.Vpc.Upa.Entity entity, object @object) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.EntitySecurityManager s = entity.GetEntitySecurityManager();
     if (s != null)
     {
         return(s.IsAllowedPersist(entity, @object));
     }
     return(IsAllowedKey(entity, "Persist"));
 }
Exemplo n.º 6
0
        /**
         *
         * @param field
         * @param id
         * @param object
         * @return
         * @throws UPAException
         */

        public virtual bool IsAllowedWrite(Net.Vpc.Upa.Field field, object id, object @object) /* throws Net.Vpc.Upa.Exceptions.UPAException */
        {
            Net.Vpc.Upa.EntitySecurityManager s = field.GetEntity().GetEntitySecurityManager();
            if (s != null)
            {
                return(s.IsAllowedWrite(field, id, @object));
            }
            return(IsAllowedKey(field.GetEntity(), "Update"));
        }
Exemplo n.º 7
0
 public virtual bool IsAllowedRead(Net.Vpc.Upa.Field field) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.EntitySecurityManager s = field.GetEntity().GetEntitySecurityManager();
     if (s != null)
     {
         return(s.IsAllowedRead(field));
     }
     return(IsAllowedKey(field.GetEntity(), "Load"));
 }
Exemplo n.º 8
0
 public virtual bool IsAllowedNavigate(Net.Vpc.Upa.Entity entity, string navigationMode) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.EntitySecurityManager s = entity.GetEntitySecurityManager();
     if (s != null)
     {
         return(s.IsAllowedNavigate(entity, navigationMode));
     }
     return(IsAllowedKey(entity, "Navigate"));
 }
Exemplo n.º 9
0
 public virtual bool IsAllowedLoad(Net.Vpc.Upa.Entity entity) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.EntitySecurityManager s = entity.GetEntitySecurityManager();
     if (s != null)
     {
         return(s.IsAllowedLoad(entity));
     }
     return(IsAllowedKey(entity, "Load"));
 }
 public SecurityManagerEntityConfigurator(Net.Vpc.Upa.EntitySecurityManager s)
 {
     this.s = s;
 }
Exemplo n.º 11
0
 public virtual void PersistenceUnitItemScanned(Net.Vpc.Upa.ScanEvent @event)
 {
     if (listener != null)
     {
         listener.PersistenceUnitItemScanned(@event);
     }
     Net.Vpc.Upa.PersistenceUnit persistenceUnit = @event.GetPersistenceUnit();
     System.Type contract = @event.GetContract();
     System.Type type     = @event.GetVisitedType();
     if (Net.Vpc.Upa.Impl.Config.URLAnnotationStrategySupport.IsPersistenceUnitItemDefinitionListener(contract))
     {
         object i = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <System.Type, object>(instances, type);
         if (i == null)
         {
             i = persistenceUnit.GetFactory().CreateObject <object>(type);
             instances[type] = i;
         }
         Net.Vpc.Upa.Config.Decoration at = (Net.Vpc.Upa.Config.Decoration)@event.GetUserObject();
         string _filter             = at.GetString("filter");
         bool   _trackSystemObjects = at.GetBoolean("trackSystemObjects");
         //                    Callback cb = (Callback) at.getAnnotation();
         if ((_filter).Length == 0)
         {
             persistenceUnit.AddDefinitionListener((Net.Vpc.Upa.Callbacks.DefinitionListener)i, _trackSystemObjects);
         }
         else
         {
             persistenceUnit.AddDefinitionListener(_filter, (Net.Vpc.Upa.Callbacks.DefinitionListener)i, _trackSystemObjects);
         }
     }
     else if (typeof(Net.Vpc.Upa.Callbacks.PersistenceUnitListener).Equals(contract))
     {
         object i = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <System.Type, object>(instances, type);
         if (i == null)
         {
             i = persistenceUnit.GetFactory().CreateObject <object>(type);
             instances[type] = i;
         }
         persistenceUnit.AddPersistenceUnitListener((Net.Vpc.Upa.Callbacks.PersistenceUnitListener)i);
     }
     else if (typeof(Net.Vpc.Upa.Callbacks.EntityInterceptor).Equals(contract))
     {
         Net.Vpc.Upa.Callbacks.EntityInterceptor i = (Net.Vpc.Upa.Callbacks.EntityInterceptor)Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <System.Type, object>(instances, type);
         if (i == null)
         {
             try {
                 i = (Net.Vpc.Upa.Callbacks.EntityInterceptor)persistenceUnit.GetFactory().CreateObject <object>(type);
             } catch (System.Exception ex) {
                 log.TraceEvent(System.Diagnostics.TraceEventType.Error, 100, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter(null, ex));
             }
             if (i != null)
             {
                 instances[type] = i;
             }
         }
         if (i != null)
         {
             Net.Vpc.Upa.Config.Decoration at = (Net.Vpc.Upa.Config.Decoration)@event.GetUserObject();
             string _filter = at.GetString("filter");
             string _name   = at.GetString("name");
             if (Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(_name))
             {
                 _name = (i.GetType()).Name;
             }
             bool _trackSystemObjects = at.GetBoolean("trackSystemObjects");
             //                    Callback cb = (Callback) at.getAnnotation();
             persistenceUnit.AddTrigger(_name, i, _filter, _trackSystemObjects);
         }
     }
     else if (typeof(Net.Vpc.Upa.EntityDescriptor).Equals(@event.GetContract()))
     {
         Net.Vpc.Upa.EntityDescriptor desc = (Net.Vpc.Upa.EntityDescriptor)@event.GetUserObject();
         persistenceUnit.AddEntity(desc);
     }
     else if (typeof(Net.Vpc.Upa.Function).Equals(@event.GetContract()))
     {
         Net.Vpc.Upa.Function          f = (Net.Vpc.Upa.Function)persistenceUnit.GetFactory().CreateObject <T>(@event.GetVisitedType());
         Net.Vpc.Upa.Config.Decoration d = (Net.Vpc.Upa.Config.Decoration)@event.GetUserObject();
         //                net.vpc.upa.config.FunctionDefinition d = type.getAnnotation();
         Net.Vpc.Upa.Types.DataType dt = Net.Vpc.Upa.Types.TypesFactory.ForPlatformType(d.GetType("returnType"));
         string n = d.GetString("name");
         if (Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(n))
         {
             n = d.GetLocationType();
         }
         persistenceUnit.GetExpressionManager().AddFunction(n, dt, f);
     }
     else if (typeof(Net.Vpc.Upa.Callback).Equals(@event.GetContract()))
     {
         Net.Vpc.Upa.Callback callbackType = (Net.Vpc.Upa.Callback)persistenceUnit.GetFactory().CreateObject <T>(@event.GetVisitedType());
         persistenceUnit.AddCallback(callbackType);
     }
     else if (typeof(Net.Vpc.Upa.EntitySecurityManager).Equals(@event.GetContract()))
     {
         Net.Vpc.Upa.Config.Decoration     d    = (Net.Vpc.Upa.Config.Decoration)@event.GetUserObject();
         Net.Vpc.Upa.EntitySecurityManager secu = (Net.Vpc.Upa.EntitySecurityManager)persistenceUnit.GetFactory().CreateObject <T>(@event.GetVisitedType());
         Net.Vpc.Upa.Impl.Config.EntityConfiguratorProcessor.ConfigureOneShot(persistenceUnit, new Net.Vpc.Upa.Impl.Util.SimpleEntityFilter(new Net.Vpc.Upa.Impl.Util.EqualsStringFilter(d.GetString("entity"), false, false), true), new Net.Vpc.Upa.Impl.Config.SecurityManagerEntityConfigurator(secu));
     }
     else if (@event.GetUserObject() is Net.Vpc.Upa.Impl.Config.DecoratedMethodScan)
     {
         Net.Vpc.Upa.Impl.Config.DecoratedMethodScan dms  = (Net.Vpc.Upa.Impl.Config.DecoratedMethodScan)@event.GetUserObject();
         Net.Vpc.Upa.Config.Decoration callbackDecoration = dms.GetDecoration();
         ConfigureMethodCallback(type, dms.GetMethod(), callbackDecoration, persistenceUnit);
     }
 }