예제 #1
0
        static void RegisterFactor_UserState(BizTransaction transaction, BzureUser user)
        {
            IEntityRequestProcess userStateProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> userStateFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(userStateProcessor);
            userStateFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            userStateFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {
                EntityPostRequest OrderRequest = BuilderUserStateRequest(user);
                action(userStateProcessor, OrderRequest);
            };

            transaction.RegisterFactor(userStateFactor);
        }
예제 #2
0
        static void RegisterFactor_DeleteOldDroits(BizTransaction transaction, string resourceid)
        {
            IEntityRequestProcess deleteDroitsProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> deleteDroitsFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(deleteDroitsProcessor);
            deleteDroitsFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            deleteDroitsFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {

                EntityPostRequest deleteDroitRequest = BuilddeleteDroitRequest(resourceid);
                action(deleteDroitsProcessor, deleteDroitRequest);

            };

            transaction.RegisterFactor(deleteDroitsFactor);
        }
예제 #3
0
        static void RegisterFactor_AddNewDroits(BizTransaction transaction, string ResourceName, DroitResource[] droits)
        {
            IEntityRequestProcess addDroitsProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> addDroitsFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(addDroitsProcessor);
            addDroitsFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            addDroitsFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {
                foreach (DroitResource droit in droits)
                {
                    EntityPostRequest addDroitRequest = BuildaddDroitRequest(ResourceName, droit);
                    action(addDroitsProcessor, addDroitRequest);
                }
            };

            transaction.RegisterFactor(addDroitsFactor);
        }
예제 #4
0
        static void RegisterFactor_DeleteRoles(BizTransaction transaction, BzureUser user, string[] oldRoles)
        {
            IEntityRequestProcess deleteRolesProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> deleteRolesFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(deleteRolesProcessor);
            deleteRolesFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            deleteRolesFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {
                foreach (string roleid in oldRoles)
                {
                    EntityPostRequest deleteRoleRequest = BuilddeleteRoleRequest(user.UserID.ToString(), roleid);
                    action(deleteRolesProcessor, deleteRoleRequest);
                }
            };

            transaction.RegisterFactor(deleteRolesFactor);
        }
예제 #5
0
        static void RegisterFactor_DeleteUserRole(BizTransaction transaction, string RoleID)
        {
            IEntityRequestProcess deleteUserRoleProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> deleteUserRoleFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(deleteUserRoleProcessor);
            deleteUserRoleFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            deleteUserRoleFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {

                EntityPostRequest deleteUserRoleRequest = BuilddeleteUserRoleRequest(RoleID);
                action(deleteUserRoleProcessor, deleteUserRoleRequest);
            };

            transaction.RegisterFactor(deleteUserRoleFactor);
        }