예제 #1
0
 public void OnPostLoad(PostLoadEvent @event)
 {
     Debug.WriteLine(string.Format("OnPostLoad - {0}", @event.Entity));
     if (@event.Entity is IDataObject)
     {
         ServiceDataAuthorizationConnector.Check((IDataObject)@event.Entity,
                                                 DataOperation.Retreive);
     }
 }
예제 #2
0
        public override void OnDelete(object entity, object id, object[] state, string[] propertyNames, global::NHibernate.Type.IType[] types)
        {
            Console.WriteLine("Delete: {0}:{1} (ctx: {2})", entity, id, CurrentUserContext.AccountId);

            if (entity is IDataObject)
            {
                ServiceDataAuthorizationConnector.Check((IDataObject)entity, DataOperation.Delete);
            }

            base.OnDelete(entity, id, state, propertyNames, types);
        }
예제 #3
0
        public override bool OnLoad(object entity, object id, object[] state, string[] propertyNames, global::NHibernate.Type.IType[] types)
        {
            Console.WriteLine("Load: {0}:{1} (ctx: {2})", entity, id, CurrentUserContext.AccountId);

            if (entity is IDataObject)
            {
                ServiceDataAuthorizationConnector.Check((IDataObject)entity, DataOperation.Retreive);
            }

            return(base.OnLoad(entity, id, state, propertyNames, types));
        }
예제 #4
0
        public bool OnPreInsert(PreInsertEvent @event)
        {
            Debug.WriteLine(string.Format("OnPreInsert - {0}", @event.Entity));

            if (@event.Entity is IDataObject)
            {
                // the function returns true if the operation should be vetoed
                // consider returning false instead of throwing
                ServiceDataAuthorizationConnector.Check((IDataObject)@event.Entity,
                                                        DataOperation.Create);
            }

            return(false);
        }