Commit 4a115cd6 authored by Łukasz Nowak's avatar Łukasz Nowak

Implement private and friends computers.

Now it is possible to lock down computer to be available only to owner or
selected friends.

Squashed commit of the following:

commit d46f5cd0d4eeb6ebe75481b6f555a5aca9eac511
Merge: 8477635 0737bcf0
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Nov 3 17:59:32 2011 +0100

    Merge branch 'master' into ghostbusters

    Conflicts:
    	master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py

commit 84776355fb2c110f56a3e237fbde87966b916cec
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 17:33:48 2011 +0100

    Usage report packing list also trigger this interaction script.

    Such delivery contains multiple lines

commit cebc827c7f4a349c517f83734468597e605e003a
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 15:35:55 2011 +0100

    Reindex partition when modifying the destruction deliveries

commit 2213015d184006ec18470af9ae9a8b0084653478
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Nov 3 15:33:28 2011 +0100

    Put slave related tests to different file.

commit 2d2990b75ece15a8a87600459ee078ea99135e42
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 15:30:43 2011 +0100

    Removing partition from their table is the way to prevent new instanciation

commit e5d8540973a08d7fac565ee32f121ac7dc6d9a4a
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Nov 3 14:59:46 2011 +0100

    Follow slap library changes.

    Additionaly logout from slap too.

commit d902310cacae19e574e940fe4b74af33184874a7
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Nov 3 14:49:14 2011 +0100

    Drop pdb.

commit 885bdaa31ced4df2b92b7e5a610ac5a476bb6e3f
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 14:08:00 2011 +0100

    Use portal_catalog to filter.

commit 669de4bcabaa1ded07dffdf9581b83f72514d29d
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Nov 3 14:03:37 2011 +0100

    Update local roles in end of transaction.

    There are a lot of modifications on Open Sale Order happening during one
    transaction, so in order to fetch real data from open order during update local
    roles do it as late as possible during transaction.

commit d134011374e630837e84a4b7982c48b405202687
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 13:35:13 2011 +0100

    Partition are destroyed by the Computer

commit 6b78b0758e8e2410af73a821876fd6252d041176
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 11:58:06 2011 +0100

    User is not allowed to access the partition document.

commit ff7a324c4c00e2da84da4852dab37440a8f075e9
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Nov 3 11:55:31 2011 +0100

    YAT-TA!

commit 023f6a92a5dfaba0ded9b0c8f04134ffc94f0f6c
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Nov 3 11:34:39 2011 +0100

    Restore back Slave Instance destroyed support.

commit 4960b97da7f73be631c905f0852cfbe3c90c4fbd
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 11:28:12 2011 +0100

    Software type is provided by the sequence

commit 36e0c756fbe875e8a40989880581ab7a87609d4a
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 11:22:09 2011 +0100

    Instance software type is defined by the sequence.

commit 5e8c2db393761e4cd323415c04e2e07d23dbba50
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 11:15:01 2011 +0100

    state parameter may be already provided by method parameters.

commit 77be3f3608cd3f92ad76b5829dedd7aa39544945
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Nov 3 11:11:01 2011 +0100

    Drop failure expectations.

    After Romain avoided groups growing for a Person, this test shall pass.

commit d09f1d3173b96c24d57a37481a5f6e16a3346ed8
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 11:02:38 2011 +0100

    Restore hack to allow the validation of the instance

commit 2fe62055497be08b1b096a2bbc0e98222dc7f0a4
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 10:36:48 2011 +0100

    Prevent explosion of person security group.

    A person who has 1 million of Hosting Subscription should have limited number of security group.

commit 8d7b8f8417d1bbbbcf46f2a322b88fb22d0463b0
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Nov 3 10:08:54 2011 +0100

    Update XML

commit 969437b373090784e7350765251ec3a84b64a8eb
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 18:23:03 2011 +0100

    Synchronise software type with rest of tests.

commit e40d2b3a19de8fda8d400a338ac16fcde5f18f7a
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 18:10:52 2011 +0100

    Use consitent way of activity locking.

commit 953c96a4224c997947e7fab743b8dbda55f716a8
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 16:40:32 2011 +0100

    Trigger only once per transaction.

commit d1ac5aa33b10657b47ed98369265fea64a461330
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 16:28:23 2011 +0100

    Separate requested software type from reference.

    While requesting Slave Partition software type have to be the same.

commit 765bdd2cee085494b48882b9894f901f3c42d904
Author: Romain Courteaud <romain@nexedi.com>
Date:   Wed Nov 2 15:57:06 2011 +0100

    Person is not reindexed yet when the open order is created.

    No way to use set'Category'Uid in this case.

commit 2adf671815fec15152057eac200d280c0fd24b0b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 15:49:27 2011 +0100

    Set reference too.

    It is used for example during login.

commit 3664995bdf9ae14326bcf759cf9fcaf61452d276
Author: Romain Courteaud <romain@nexedi.com>
Date:   Wed Nov 2 15:37:04 2011 +0100

    Production manager can manage open sale order of customer.

commit e30281597dd4b33ed93e97bbea12c4bef476b65b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 14:54:42 2011 +0100

    Mark expected failure.

commit 078b2f999b1d3bdc03ef92fd55f7d6e0ad432583
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 14:45:49 2011 +0100

    Stabilise assertions.

    In some cases different amount of packing lists are expected.

commit 27e48e872b566b6d04ec65640f0f2e0d35d5f8f0
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 14:42:53 2011 +0100

    Only one slave is checked.

commit 4ec1ec6abd717eee95f3d07220fe04510ce6032f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 14:38:45 2011 +0100

    Returned delivery line can be for Slave Instance.

commit 860c4ed22ffb9f791d0287188fb1bafd9de5fd1f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 14:25:35 2011 +0100

    Assert after each action.

    Again: it allows to raise early with understandable message.

commit b5e015e09ffa868c5c4fc843e52304e526818c3b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 13:58:30 2011 +0100

    Allow to track Slave Instances.

commit 50b782d464945b8e423937ed4c8039f063d7524c
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 13:56:17 2011 +0100

    Show type.

    One then more portal type can be in module.

commit fc02501438d0c68461cebbfdbdb56edf0a2b681e
Author: Romain Courteaud <romain@nexedi.com>
Date:   Wed Nov 2 13:57:17 2011 +0100

    Fix verification of instance's software_type

commit 3c25275654be1b0d9662ecb4696ffc2ca77d53fd
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 13:07:11 2011 +0100

    Force join in catalog queries.

    *_value is silently dropped while generating query.

commit a4a20493b5a17469b46c99f73049c35f1bbb917c
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 13:01:36 2011 +0100

    Force join.

    Passing _value just silently drops condition.

commit 63ed13b4d4893cafd7c0c8c14554852b8ea8f6a6
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 12:07:33 2011 +0100

    Edit in one shot.

commit 76e7ff5902d01e65349460e57915b9c6df1bc17b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 12:00:06 2011 +0100

    Check that what shall be done is done.

    Those methods are working on higher level, so catch early any issue, instead of
    failing late with bizzare messages.

commit 6b850c84ee6c0d45c79186c9752c951e6bef8272
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 11:43:15 2011 +0100

    Revert "Allocation scope has higher priority then friend list."

    This reverts commit fdf5c9267828828a404d58ae529c6d24f79a6616.

    Real bug shall be hunted and fixed instead.

commit fdf5c9267828828a404d58ae529c6d24f79a6616
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 11:17:44 2011 +0100

    Allocation scope has higher priority then friend list.

    open/public is public, whatever is configuration of trade condition.

commit c0bce742a55b54bb0b4b333741326e0645ab2bae
Author: Romain Courteaud <romain@nexedi.com>
Date:   Wed Nov 2 11:04:53 2011 +0100

    Slave partition have to request the same software type.

commit 735ff1f5691aafd8a1b2c8a03d1ea8c442a29313
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 10:10:30 2011 +0100

    When closing computer no change is done to friend list.

commit c55b84c97ca3a95c3891c694d15c27dccc260ae3
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 10:01:24 2011 +0100

    Simplify allocation/scope impact updates.

    open/personal shall result in STC for self.
    open/public shall result in STC for noone.
    open/friend shall have self always.

commit 0cac12ae1a6e8da407c7a1063d7b7f1296f7f0bd
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Nov 2 10:00:00 2011 +0100

    Check destination_section category.

    It is more important than subject_list, as it impacts system behaviour.

commit 8b46e60ff9b1bce6f4b9b121aa6951f4d29219a8
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 18:54:36 2011 +0100

    Fix another stabilisation.

commit 03c80efc378131a1c91a524975131d52b1c1b3b1
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 18:52:08 2011 +0100

    Restabilise subject list checks.

commit fa95a4aa0c31ea7ae6a31405376f3fdea50e178c
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 18:34:24 2011 +0100

    Remove not used module.

commit 121245368c17003cd4a981c8eca50f0232509401
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 18:34:10 2011 +0100

    uid is needed too.

commit e99a4b52aabb573a25f13e8182fd1d33cc9144fd
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 18:28:22 2011 +0100

    Store software instance reference too.

    It is used to login.

commit 4d691bac97a42c594873b3c3fc2f964b7cb06df0
Author: Romain Courteaud <romain@nexedi.com>
Date:   Mon Oct 31 18:19:54 2011 +0100

    Bypass trade condition security to apply it.

commit 2e1d7d7eae03dd79e956fd75b8ca0f463fe35d7a
Author: Romain Courteaud <romain@nexedi.com>
Date:   Mon Oct 31 18:19:17 2011 +0100

    Use uid to discover the lastest deliveries.

commit a1ec726f1ff6d20e42db72573c803d736c2a8cf0
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 17:26:50 2011 +0100

    Implement friend based scenario.

commit 0fdbeb26d5376d8b5c70bf8f490b362014620dac
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 17:06:50 2011 +0100

    Follow changes in subject list configuration.

commit 10cbaa6cd8bf30743e71fa056331968cb9ec10b1
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 17:04:13 2011 +0100

    Manipulate subject_list in "intelligent" way.

    Non open/public computer shall have self in subject list.

commit 2f44ac44cf9fef2a7fce22461033a47729b33b5a
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 16:57:49 2011 +0100

    Except different presentation of emptiness.

commit e57a74c2fdf176afded4baca70ad215a0f4ee996
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 16:37:26 2011 +0100

    Adding anyone to friend list adds owner.

commit c643564cb72eb320578997d545a2ad0c61f97d67
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 16:34:06 2011 +0100

    In case of adding friends, add self to friend list.

commit 6e6bb356c4c516fdcff6f1cfe20705159c351c2a
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 16:20:09 2011 +0100

    Restrict search.

    This script can be run as super user, so no restriction will apply.

commit 8c86cdf8cdb950f6d9269fe1246a4df11f46daa2
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 16:01:47 2011 +0100

    Do the SQL join.

    destination_decision_value was just droppped.

commit d67eb23b1a335b4030934441433d73f3a29f2f3f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 15:43:07 2011 +0100

    Create open order while opening assignment.

    Open Order have to exists as soon as possible, as they are used in security
    configuration.

commit 266a37a98e9c8e8be21f976a49636cf322fb9eaa
Author: Romain Courteaud <romain@nexedi.com>
Date:   Mon Oct 31 15:25:50 2011 +0100

    Computer is public in most tests.

commit 8b8a31d6fffeab565c68704c18849794edd57698
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 14:35:37 2011 +0100

    Wait for Trade Condition, Supply Line and computer.

    Trade Condition state might be chanining, and it is used in catalog queries.
    Supply Line and Computer relation might be ongoing, and it is important from
    catalog point of view.

commit a464172f5af751c3ef5bf3c8407df4777bd4f4c7
Author: Romain Courteaud <romain@nexedi.com>
Date:   Mon Oct 31 14:56:19 2011 +0100

    Define the computer as public.

commit 79e96382ff57bd5cb469e388a6068c7874ba348c
Author: Romain Courteaud <romain@nexedi.com>
Date:   Mon Oct 31 14:43:51 2011 +0100

    Share steps with more tests

commit ad12ae87ef8c6dcfa4d1f8fb050083ef11012883
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 13:58:19 2011 +0100

    Stabilise assertions.

    Sometimes empty means empty list and sometimes list of empty string.

commit 88bb5c78611a9ac04df4ff29856017e7f288df1b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 13:34:34 2011 +0100

    Request twice.

    It is related with async request on slap library level.

commit 649d3789b3515307d022ed17a52742ffa05cf452
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 13:30:56 2011 +0100

    No need to mark busy again.

    Code was refactored to do it before.

commit 260958168f7898630d9d6788db527307677cb996
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 12:56:46 2011 +0100

    Pass positional arguments to External Method.

commit f01faa98a11b1d5f0231c90efe4518293b9fc05e
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 12:56:01 2011 +0100

    Change signature.

    There are issues with External Method calls.

    Sometimes the first argument is context object of call, sometimes it is first
    one passed. Force using positional arguments then.

commit 222dfe8e085e6871c25474a4acec5157768d1857
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 11:56:24 2011 +0100

    No timeout in tests.

commit 1c9c4f6e43530b1474b0e12899b3ed2e71898e3a
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 11:51:13 2011 +0100

    Simplify.

commit 68d18b61ca3970432f67ce201b98d9b384a43222
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 11:37:30 2011 +0100

    Allow to access Open Sale Order for HS group.

commit 465410652d5bc427ed411dcb7c6eb12347485978
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 11:06:10 2011 +0100

    Use UnrestrictedMethod.

    It allows to do "atomic bomb security surgery" by defining exactly required
    security "escalation".

commit 26531ae9925d3e66f26ea285b71b10ce7a15f8a5
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 10:33:59 2011 +0100

    Find parent_uid in unrestricted environment.

    Computer is not accessible to Software Instance, but it is required to fetch
    correct computer partition.

commit ef4248cbee79440feee43117846c87217cc8e884
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 10:28:15 2011 +0100

    Fetch data as super user.

    According to configuration in this moment the data shall be available to
    Software Instance.

commit 05ac40d223350d885f78a9476a721451e2b8b969
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 31 09:59:10 2011 +0100

    Update local roles on Computer Partition too.

    It is required to give access to it for Software Instance user.

commit 4ac88d055622aaf6eddd04818eb6afc4753255bd
Author: Romain Courteaud <romain@nexedi.com>
Date:   Mon Oct 31 09:42:19 2011 +0100

    Give auditor role on busy partition.

    This will instance to find their IP.

commit 5d92540ee8bac32d2a15e3256614fb37a1e0ab61
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 18:51:56 2011 +0200

    Use acl_users instead of portal_membership.

    There were issues with getting roles in context with portal_membership.

commit 245113bc09d4424057e694e5f6625cb104977523
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 17:11:49 2011 +0200

    Shadow user need access to the computer module

commit b89983125ad1ab16e8604db0f52917cefce1227f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 17:07:07 2011 +0200

    Fix assertion.

commit d83fc1b0299ecbc181199b2da6a48774c7ebf019
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 16:59:08 2011 +0200

    Update trade condition destination section after editing subject list

commit f26ac9e91e16e787e134fc886f06064b056c2f31
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 16:45:33 2011 +0200

    Set the subject list on the trade condition

commit 6dafd7814c58aef2b6aad74fa51e03d8d5b87760
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 16:21:41 2011 +0200

    Typo

commit 56e28fcebf48c0659da8fc6d5b27a9c03ef40e36
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 16:19:40 2011 +0200

    Wait for more activities

commit fa4004ed1d791d48a85e7b780a6787bbf579d2ad
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 16:17:59 2011 +0200

    Wait for more activities

commit 5c18218ddc1afe9275d78e3d24baafe3f21042d0
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 16:07:07 2011 +0200

    Typo

commit 8cf19d6ae4f3ba434de0d82d24bcf553199eb398
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 15:51:33 2011 +0200

    Rename method and simplify it.

    Shadow has no access to software instance, so all parameters have to be passed as strings.

commit 9133112a66c7ee87ad8e0e785d8ce9002988cc7f
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 15:36:26 2011 +0200

    Do not use the stock table to fetch the information

commit af43b6f61fb10723fd442f82b61ee622f91b0d42
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 15:33:17 2011 +0200

    Pass open_order as argument mapped to self.

commit 9ec82d031dc90a1e71b997843a1cdd0f1e709850
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 15:30:26 2011 +0200

    Call the method.

commit 1e8748f172c1def13f6a006bcb7d83c43a028987
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 15:14:49 2011 +0200

    Use shadow user to retrieve the partition

commit f2e94f302a677d677e16fe0965592f945b67779b
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 15:13:45 2011 +0200

    Return computer partition url.

    As Instance_findPartition is supposed to be called with the shadown user, prevent any unauthorized error later.

commit 1109e55ac90393bbea612ed8bb232eedc8cf9306
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 15:05:33 2011 +0200

    Shadow user should only be used to retrieve computer partition

commit bb2d019ab336a327fb64740e1f96c86f53b9fbfc
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 14:52:02 2011 +0200

    Trust the open order access restriction.

commit a9c1260e383e83455a87a11f7e508b999b18a477
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 14:48:26 2011 +0200

    Support software instance too.

commit 51a9fe407ff2ef5e7604e295b515f7197e90134f
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 14:42:43 2011 +0200

    Request partition as expected user

commit e7b4a4ef6ebbedb8768e4cacb9b7c26223c3b8e1
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 14:19:00 2011 +0200

    Call the right method on the expected object

commit 34d8bce9646b887c835d4ab74f5f2f20071dcfba
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 14:13:47 2011 +0200

    Typo

commit 3110fd198ae754f5abacca7bd61cc77d76b4c0dc
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 14:09:18 2011 +0200

    Simplify shadow user groups

commit 69ffdc5b7dd083ea22d83488fa3ee5bc786cc6d7
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 14:03:34 2011 +0200

    Simplify shadow user security group

commit d22d8d14782ff370cc12b5f7bc97eeba6c25c943
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 13:52:08 2011 +0200

    Return document instead of string

commit 112b3f600ba453a33dbf3bb6970b3f6beac6a8c8
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 13:48:06 2011 +0200

    Add more groups for Person and Software Instance.

    Each Person and Software Instance belong to role/open_order group and related
    Open Sale Order group.

commit 3ec9d3c1ca79ba2f7c7540f0d90f9cc715eec327
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 13:46:18 2011 +0200

    Add shadow role.

commit 327586b2cb0223ae8f3c1e924fe7f95b5a6dbb87
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 13:08:39 2011 +0200

    Typo

commit 10c09cc29d9897b14580fd68e429a5cb656fc353
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 12:06:39 2011 +0200

    Add role/open_order category.

commit 63cbe8c9efc11fa8a875bb72736b77fd7cc9dbb5
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 12:05:17 2011 +0200

    Give role/openorder to Open Sale Order users.

commit 5833ae265a0d824f33544ba6cf884f7b2d130d7a
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 12:02:17 2011 +0200

    Generate computer local roles based on related open sale order reference.

commit 2dfdf0c5760faff5ee07e198fd528a584a2751e3
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 11:59:04 2011 +0200

    Restrict the list of trade condition to update

commit 6717f88ec88bfa828e1ab5c7f395ea8d0f6d571e
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 11:33:10 2011 +0200

    Instance needs to access the sale trade condition module

commit 9fe47b072b488055412b0c7f337f5031c2845e80
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 11:30:51 2011 +0200

    Open Sale Order already has generated reference (configured on portal type)

commit 175544e3e994bdaf04a4db7124c9172a4ded79f2
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 11:28:58 2011 +0200

    Change Sale Trade Condition security.

    Give instance Auditor role for public sale trade condition.

    "Friends" security is based on the member's open sale order.

commit 08982cbaac1f687c5eb3c0454421124a13883ee0
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 11:23:08 2011 +0200

    Remove not needed commented out code.

commit a62497f2381d71bcaa3a8d1ecb9a4e322865b9bd
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 11:17:45 2011 +0200

    Do not catalog creation/modification date.

    In Vifib those dates are not used.

    There is issue with getting creation/modification date on big workflows, which
    leads to (1) high memory consumption and (2) not freeing memory later.

    Vifib workflows have ten thousands of entires (and they grow), so until proper
    solution if found it is better to avoid often calculation of those dates.

commit dfc47913cfe682151fe48b17ccad25011c673dfc
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 11:14:50 2011 +0200

    Do not use creation date.

    Sale Packing List Lines can be safely sorted by its start date.

commit e18600a6bb479feb2254c29fbeb3a67019f7cf90
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 11:09:25 2011 +0200

    Finalise switch method.

    Simplify passed arguments -- any callable with arguments can be passed.

commit 335781cdf5e351af0ed0cc15798fa4986641a847
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Oct 28 10:36:48 2011 +0200

    Typo

commit 07e77a6b50b01c9d1707e571d9c1bc81ed4bfada
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 10:33:04 2011 +0200

    Fix copy&paste mistake.

commit 4b4e52f9a5bfe28417027f20c1fd1332f1594e34
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Fri Oct 28 10:10:48 2011 +0200

    Disable failing functionality.

commit 45be4c6debd598375c4573637b67b9dd5bab8a66
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 19:26:39 2011 +0200

    WIP external method to run code as 'shadow' user

commit 601dbcf27af93df7b1fc0c2efc7d2e0e4d36e7ca
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 19:24:26 2011 +0200

    Forgotten modification in previous commit

commit e6700aad6ae15947cbf3949e1548bd7795214f1b
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 19:23:32 2011 +0200

    Initialize open sale order reference

commit 6b5dc641dc8c69747abbd466b5794ce257508257
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 19:16:36 2011 +0200

    Only catalog instanciated software release for busy partition

commit 8e6286bec236472278eea19bf6218d13999d929c
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 19:06:49 2011 +0200

    Software instance type is stored on source_reference

commit e9f36426196c5e03619dd700bd5eae47cf880ef2
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 19:05:54 2011 +0200

    Filter busy partition by software type

commit ef49bb2aa01f1c7cb8f8541855f688ab4d9a0577
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 18:54:49 2011 +0200

    Share the code by using Instance_findPartition

commit e7ff5c843747c58748d6e1f760500eb328d8675e
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 18:51:25 2011 +0200

    Prevent copy/paste by creating a new script to find a partition

commit 4e71ade4a9ef5c401649c249c99639436bc9361a
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 18:15:35 2011 +0200

    Activate shadow plugin in tests.

commit 5e6bfd51e8432755512b3a5538f6a03c6b0ed0a5
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 18:12:19 2011 +0200

    Initiate development of shadow plugin.

    Shadow users will allow to have a "bit different" groups then normal ones.

    They will be used in order to select normally not available objects (like
    computer).

    This plugin will disallow normal login (not extract credentials), as it shall
    be used only internally (similarly to sudo).

commit 0376d8ad540cb4e9b5226735a2f05128b163fd93
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 17:45:02 2011 +0200

    Implement test_start_computer_partition_allocation_scope_close.

commit aa40a28011583a2860c16b1b8674f4c08c208614
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 17:26:28 2011 +0200

    YATTA: Yet Another Test To check After close start behaviour.

commit 32a740cfb9e000ada553c4ec1f2c968606547794
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 17:22:15 2011 +0200

    Finalise skeletonising request.

    Only friend partition request case is left.

commit 3afb0e4a3093c706d78e581e3364dd2c05925ba5
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 17:10:57 2011 +0200

    Restrict workflow action usage

commit 18d637876789a24154cd4bb10ca5476d0426da6f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 17:07:17 2011 +0200

    Skeletonise more tests for request.

    Also do additional check: proof that even if someone incorrect was not able
    to request instance, correct one (the friend, the owner) can do it. Thanks to
    this the test assuers (quite well...) that refusal of requestion was because
    of configuration and not artificial problem.

commit 4b62f9e2d04844b2ee7881eed553500e66597969
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 17:06:12 2011 +0200

    Cover open/friend with friend.

commit d75b15bd453eeb128c5ee0e89839ec7618a0fc50
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 17:05:13 2011 +0200

    Allow to login as test_vifib_customer_a

commit 2d06c16c9d909ed50e87fd6c282f15a0b1919617
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 16:55:16 2011 +0200

    Start covering cases of software instance request.

commit 48b411bb511b1e8a3bd66ec4a5ed1c0fa028ac14
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 16:47:06 2011 +0200

    YAT(ta).

    Yet another typo (ta).

commit 33d72cddf8b6d04bfe27ad430ad28d8c482ab875
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 16:45:55 2011 +0200

    Typo.

commit ebb1051c1556996de683fd31189078e1787968fa
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 16:44:18 2011 +0200

    Cover empty allocation scope.

commit fc59fed9c51a8b007dae40c196d8e1cac8b641b5
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 16:42:46 2011 +0200

    Cover case of allocation scope close.

commit 96c01c7cb5061a3abfabea013148098a1c929407
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 16:38:04 2011 +0200

    Test open/public allocation scope.

commit a0a6fb15048a6b1e6256066b020eda667a5084bc
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 16:32:29 2011 +0200

    Finish open/personal allocation scope test.

commit 2349abad932e516790f94329a6fbf52668465c6c
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 16:07:08 2011 +0200

    Validated in the end.

    It will allow to fetch data about the object.

commit 0cb5494eecd794fe54365a6f4603e82bedcdfbee
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 15:55:03 2011 +0200

    Initialize sale trade condition reference

commit 6199dbfffcd3733e522453f25e332911fbbead84
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 15:39:26 2011 +0200

    Request on known computer.

commit 6a84303ca83288c0889b96c43e4ccc1d0f8d4546
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 15:39:07 2011 +0200

    Support sla_xml for person.

commit e78beca259b9245b14e40c2763b9610bf4d77ce3
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 15:34:27 2011 +0200

    Copy/paste is an easier solution to get ride of typo...

commit 90ff7420c52997f6ad1321b5c3c319be2d858388
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 15:28:21 2011 +0200

    Typo in script name

commit 45712d0d62f4177eae8b499819be93dab75accb4
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 15:25:09 2011 +0200

    Revert "Update local roles in end of transaction."

    This reverts commit aff2708b66a9037d3f67d46951d28af6dc227872.

commit 1f1a6f2c4955362c3493441df9682cf3f71f29fe
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 15:21:22 2011 +0200

    Add more test steps.

commit 22fe142f112208b1c0de78ef03d7629d2d0c5775
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 15:13:42 2011 +0200

    Tic after publishing software release.

commit aff2708b66a9037d3f67d46951d28af6dc227872
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 14:44:44 2011 +0200

    Update local roles in end of transaction.

    During the whole transaction roles could have not expected result.

commit 7f08884155a69d6fc7c8a71dd44283f8fb8450aa
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 15:16:27 2011 +0200

    XML changes

commit af224b4cfaf845b6d17b3d48aefce2cb1966a007
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 15:10:23 2011 +0200

    Give Auditor role on computer depending on sale trade condition configuration.

commit 374e08157bac0aed48add551310837dfa6041f59
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 14:32:13 2011 +0200

    Initiate test implementation.

commit c761161e430002b808cede00d1a5f5eeae01b406
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 14:11:53 2011 +0200

    Send empty string in case of no list.

commit 112b090b111f1405b13e47e7556a713f1bb088f5
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 13:55:57 2011 +0200

    Sekeltonise allocation scope tests.

commit 838c5dcd3660c452c8e7e49471cad35182a4ef27
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 14:30:53 2011 +0200

    Supplier of the trade condition should be allowed to modify it.

commit 729c9516415149716ddc8804b8035f0549bfde94
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 14:29:52 2011 +0200

    Set default allocation scope on computer.

    By default, only its administrator can allocate service on it.

commit 72f5c606e4be095199fdc33fd4c786c6c4ae7947
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 14:23:45 2011 +0200

    Change sale trade condition roles based on their relation, in order to make them viewable to other members.

commit d1d5cb4d23c1abd74cb0ea189d013b4f95277b6b
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 12:02:39 2011 +0200

    Allow to edit the computer allocation scope and friends list.

commit 797d1731582097c0501389e29afcc22bfb5030a0
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 11:16:18 2011 +0200

    Only partitions belonging to computer which is open are free.

commit 6b0f63df8dc4b594cad8de4c7c4cb73dc25bf9d9
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Oct 27 10:26:00 2011 +0200

    Follow changes in slap library.

    First request is not returning the whole object, so second one have to be done.

    In some places redo a logic a bit in order to follow new way of slap library
    usage.

commit 77bbd4dc553f3bead251a35dd029412e30c5919d
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 10:36:48 2011 +0200

    The supply trade condition is created with the instance setup service.

commit 90b31bf9458d1b522fa9995bc7e0d3336a4b7e1d
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Oct 27 10:00:21 2011 +0200

    Create a default sale trade condition to restrict computer usage to only its administrator by default

commit 015230d8889d944fac0b4784e3b4ea40a76e8d7f
Author: Romain Courteaud <romain@nexedi.com>
Date:   Wed Oct 26 17:15:02 2011 +0200

    Remove computer access on trade condition by default

commit 9163efca54c0579ba284ddbf00d2be51eb8e4ccc
Author: Romain Courteaud <romain@nexedi.com>
Date:   Wed Oct 26 13:53:33 2011 +0200

    Restrict access to computers.
parent 0737bcf0
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>unfiltered_tracking_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Item Tracking</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Item_viewTrackingList?current:int=0</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -50,10 +50,34 @@ ...@@ -50,10 +50,34 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>computer = context.getParentValue()\n <value> <string>slap_state = context.getSlapState()\n
if computer.getPortalType() != \'Computer\':\n portal = context.getPortalObject()\n
computer = computer.getParentValue()\n portal_preferences = portal.portal_preferences\n
return computer.Computer_getSoftwareReleaseUrlStringList([\'stopped\'])\n \n
if slap_state == \'free\':\n
computer = context.getParentValue()\n
return computer.Computer_getSoftwareReleaseUrlStringList([\'stopped\'])\n
\n
elif slap_state == \'busy\':\n
\n
# Partition under destruction does not accept new slave\n
try:\n
delivery_line = context.Item_getInstancePackingListLine(service_relative_url=portal_preferences.getPreferredInstanceCleanupResource())\n
except ValueError:\n
pass\n
else:\n
return []\n
\n
try:\n
delivery_line = context.Item_getInstancePackingListLine()\n
except ValueError:\n
pass\n
else:\n
software_release = delivery_line.getAggregateValue(portal_type=\'Software Release\')\n
return [software_release.getUrlString()]\n
\n
else:\n
return []\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -55,9 +55,9 @@ ...@@ -55,9 +55,9 @@
except ValueError:\n except ValueError:\n
pass\n pass\n
else:\n else:\n
software_instance = delivery_line.getAggregateValue(portal_type=\'Software Instance\')\n software_instance = delivery_line.getAggregateValue(portal_type=[\'Software Instance\', \'Slave Instance\'])\n
if software_instance is not None:\n if software_instance is not None:\n
return software_instance.getTitle()\n return software_instance.getSourceReference()\n
return ""\n return ""\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -50,7 +50,9 @@ ...@@ -50,7 +50,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>return context.getPortalObject().portal_workflow.isTransitionPossible(context, \'mark_busy\') and 1 or 0\n <value> <string>if context.getPortalObject().portal_workflow.isTransitionPossible(context, \'mark_busy\') and context.getParentValue().isMemberOf(\'allocation_scope/open\'):\n
return 1\n
return 0\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
import random\n
open_sale_order = context\n
\n
computer_partition = None\n
query_kw = {\n
\'software_release_url\': software_release_url,\n
\'portal_type\': \'Computer Partition\',\n
}\n
if software_instance_portal_type == "Slave Instance":\n
query_kw[\'free_for_request\'] = 0\n
query_kw[\'software_type\'] = software_type\n
elif software_instance_portal_type == "Software Instance":\n
query_kw[\'free_for_request\'] = 1\n
else:\n
raise NotImplementedError, "Unknown portal type %s" % \\\n
software_instance_portal_type \n
# support SLA\n
if "computer_guid" in filter_kw:\n
query_kw["parent_reference"] = filter_kw["computer_guid"]\n
\n
SQL_WINDOW_SIZE = 50\n
\n
# fetch at mot 50 random Computer Partitions, and check if they are ok\n
isTransitionPossible = open_sale_order.getPortalObject().portal_workflow.isTransitionPossible\n
result_count = open_sale_order.portal_catalog.countResults(**query_kw)[0][0]\n
offset = max(0, result_count-1)\n
if offset >= SQL_WINDOW_SIZE:\n
limit = (random.randint(0, offset), SQL_WINDOW_SIZE)\n
else:\n
limit = (0, SQL_WINDOW_SIZE)\n
\n
for computer_partition_candidate in context.portal_catalog(\n
limit=limit, **query_kw):\n
computer_partition_candidate = computer_partition_candidate.getObject() \n
if software_instance_portal_type == "Software Instance":\n
# Check if the computer partition can be marked as busy\n
if isTransitionPossible(computer_partition_candidate, \'mark_busy\'):\n
computer_partition = computer_partition_candidate\n
computer_partition.markBusy()\n
break\n
elif computer_partition_candidate.getSlapState() == "busy":\n
# Only assign slave instance on busy partition\n
computer_partition = computer_partition_candidate\n
break\n
\n
if computer_partition is None:\n
raise ValueError(\'It was not possible to find free Computer Partition\')\n
\n
# lock computer partition\n
computer_partition.serialize()\n
\n
return computer_partition.getRelativeUrl()\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>software_release_url, software_type, software_instance_portal_type, filter_kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>OpenSaleOrder_findPartition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -82,6 +82,10 @@ ...@@ -82,6 +82,10 @@
<string>reference</string> <string>reference</string>
<string>Reference</string> <string>Reference</string>
</tuple> </tuple>
<tuple>
<string>translated_portal_type</string>
<string>Type</string>
</tuple>
<tuple> <tuple>
<string>source_reference</string> <string>source_reference</string>
<string>Software Type</string> <string>Software Type</string>
...@@ -113,6 +117,10 @@ ...@@ -113,6 +117,10 @@
<string>reference</string> <string>reference</string>
<string>Reference</string> <string>Reference</string>
</tuple> </tuple>
<tuple>
<string>translated_portal_type</string>
<string>Type</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -50,48 +50,12 @@ ...@@ -50,48 +50,12 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>from DateTime import DateTime\n
from DateTime import DateTime\n
import random\n
\n
def checkSoftwareInstanceIsInstalledOnComputerPartition(software_release,\n
computer_partition):\n
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
resource_relative_url = (\n
portal.portal_preferences.getPreferredInstanceSetupResource(),\n
portal.portal_preferences.getPreferredInstanceHostingResource(),\n
)\n
query = ComplexQuery(Query(aggregate_relative_url=software_release.getRelativeUrl()),\n
Query(aggregate_relative_url=computer_partition.getRelativeUrl()),\n
operator="AND",\n
)\n
sale_packing_list_line_list = portal.portal_catalog(\n
portal_type=\'Sale Packing List Line\',\n
query=query,\n
resource_relative_url=resource_relative_url,\n
limit=1)\n
\n
if len(sale_packing_list_line_list) == 1:\n
resource_relative_url = (\n
portal.portal_preferences.getPreferredInstanceCleanupResource(),\n
)\n
sale_packing_list_line_list = portal.portal_catalog(\n
portal_type=\'Sale Packing List Line\',\n
query=query,\n
resource_relative_url=resource_relative_url,\n
limit=1)\n
if len(sale_packing_list_line_list) == 0:\n
return True\n
return False\n
\n \n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
software_instance = state_change[\'object\']\n software_instance = state_change[\'object\']\n
software_release_url_string = state_change.kwargs[\'software_release\']\n software_release_url_string = state_change.kwargs[\'software_release\']\n
hosting_subscription_uid = state_change.kwargs[\'hosting_subscription_uid\']\n hosting_subscription_uid = state_change.kwargs[\'hosting_subscription_uid\']\n
software_type = state_change.kwargs["software_type"]\n
tag = state_change.kwargs[\'tag\']\n
filter_kw = software_instance.getSlaXmlAsDict()\n
\n \n
# Assertion: No packing list line should be related to this software instance\n # Assertion: No packing list line should be related to this software instance\n
packing_list_line = software_instance.getAggregateRelatedValue(portal_type=\'Sale Packing List Line\')\n packing_list_line = software_instance.getAggregateRelatedValue(portal_type=\'Sale Packing List Line\')\n
...@@ -101,55 +65,6 @@ if packing_list_line is not None:\n ...@@ -101,55 +65,6 @@ if packing_list_line is not None:\n
# Find a free computer partition. This means:\n # Find a free computer partition. This means:\n
# Computer Partition which doesn\'t have non delivered sale packing list related\n # Computer Partition which doesn\'t have non delivered sale packing list related\n
\n \n
SQL_WINDOW_SIZE = 50\n
\n
computer_partition = None\n
query_kw = {\n
\'software_release_url\': software_release_url_string,\n
\'portal_type\': \'Computer Partition\',\n
\'free_for_request\': 1,\n
}\n
\n
if software_instance.getPortalType() == "Slave Instance":\n
query_kw[\'free_for_request\'] = 0\n
\n
# support SLA\n
if "computer_guid" in filter_kw:\n
query_kw["parent_reference"] = filter_kw["computer_guid"]\n
\n
# fetch at mot 50 random Computer Partitions, and check if they are ok\n
isTransitionPossible = software_instance.getPortalObject().portal_workflow.isTransitionPossible\n
result_count = software_instance.portal_catalog.countResults(**query_kw)[0][0]\n
offset = max(0, result_count-1)\n
if offset >= SQL_WINDOW_SIZE:\n
limit = (random.randint(0, offset), SQL_WINDOW_SIZE)\n
else:\n
limit = (0, SQL_WINDOW_SIZE)\n
\n
software_release = context.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n
url_string=software_release_url_string)\n
\n
for computer_partition_candidate in software_instance.portal_catalog(\n
limit=limit, **query_kw):\n
computer_partition_candidate = computer_partition_candidate.getObject()\n
# Check if the computer partition can be marked as busy (done by an interaction workflow on sale packing list level)\n
software_instance_portal_type = software_instance.getPortalType()\n
if isTransitionPossible(computer_partition_candidate, \'mark_busy\') and \\\n
software_instance_portal_type == "Software Instance":\n
computer_partition = computer_partition_candidate\n
break\n
elif software_instance_portal_type == "Slave Instance" and \\\n
checkSoftwareInstanceIsInstalledOnComputerPartition(software_release, computer_partition_candidate):\n
computer_partition = computer_partition_candidate\n
break\n
\n
if computer_partition is None:\n
raise ValueError(\'It was not possible to find free Computer Partition\')\n
\n
# lock computer partition\n
computer_partition.serialize()\n
\n
software_release_document = context.portal_catalog.getResultValue(\n software_release_document = context.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n portal_type=\'Software Release\',\n
url_string=software_release_url_string)\n url_string=software_release_url_string)\n
...@@ -158,6 +73,16 @@ software_release_document = context.portal_catalog.getResultValue(\n ...@@ -158,6 +73,16 @@ software_release_document = context.portal_catalog.getResultValue(\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n \n
hosting_subscription = software_instance.portal_catalog.getResultValue(uid=hosting_subscription_uid)\n hosting_subscription = software_instance.portal_catalog.getResultValue(uid=hosting_subscription_uid)\n
\n
open_order = portal.portal_catalog.getResultValue(\n
portal_type="Open Sale Order",\n
validation_state="validated")\n
computer_partition_relative_url = open_order.OpenSaleOrder_restrictMethodAsShadowUser(\n
open_order=open_order,\n
callable_object=open_order.OpenSaleOrder_findPartition,\n
argument_list=[software_release_url_string, software_instance.getSourceReference(),\n
software_instance.getPortalType(), software_instance.getSlaXmlAsDict()])\n
\n
sale_packing_list_line = context.HostingSubscription_getInstancePackingListLine(state_change)\n sale_packing_list_line = context.HostingSubscription_getInstancePackingListLine(state_change)\n
base_sale_packing_list = sale_packing_list_line.getParentValue()\n base_sale_packing_list = sale_packing_list_line.getParentValue()\n
# XXX: SoftwareInstance_createSalePackingList shall be used to create new Sale Packing List\n # XXX: SoftwareInstance_createSalePackingList shall be used to create new Sale Packing List\n
...@@ -176,14 +101,13 @@ sale_packing_list = sale_packing_list_module.newContent(\n ...@@ -176,14 +101,13 @@ sale_packing_list = sale_packing_list_module.newContent(\n
sale_packing_list_line = sale_packing_list.newContent(\n sale_packing_list_line = sale_packing_list.newContent(\n
portal_type=\'Sale Packing List Line\',\n portal_type=\'Sale Packing List Line\',\n
resource=context.portal_preferences.getPreferredInstanceSetupResource(),\n resource=context.portal_preferences.getPreferredInstanceSetupResource(),\n
aggregate_value_list=[software_instance, software_release_document, computer_partition, hosting_subscription]\n aggregate_list=[software_instance.getRelativeUrl(), software_release_document.getRelativeUrl(), \n
computer_partition_relative_url, hosting_subscription.getRelativeUrl()]\n
)\n )\n
\n \n
# confirm Sale Packing List\n # confirm Sale Packing List\n
sale_packing_list.confirm()\n sale_packing_list.confirm()\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
......
...@@ -3,6 +3,7 @@ Computer | computer_usage ...@@ -3,6 +3,7 @@ Computer | computer_usage
Person | get_certificate Person | get_certificate
Person | revoke_certificate Person | revoke_certificate
Slave Instance | jump_to_software_instance Slave Instance | jump_to_software_instance
Slave Instance | unfiltered_tracking_list
Slave Instance | view Slave Instance | view
Slave Instance | web_view Slave Instance | web_view
Software Instance Module | view Software Instance Module | view
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>codification</string> </key>
<value> <string>R-OPENORDER</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>effective_date</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>open_order</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Open Order</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>role/shadow</string>
</tuple>
</value>
</item>
<item>
<key> <string>codification</string> </key>
<value> <string>R-SHADOW</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>effective_date</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>shadow</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Shadow</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
82 84
\ No newline at end of file \ No newline at end of file
...@@ -26,6 +26,40 @@ ...@@ -26,6 +26,40 @@
############################################################################## ##############################################################################
from Products.ERP5Security.ERP5GroupManager import ConsistencyError from Products.ERP5Security.ERP5GroupManager import ConsistencyError
from AccessControl.SecurityManagement import getSecurityManager, \
setSecurityManager, newSecurityManager
from AccessControl import Unauthorized
def restrictMethodAsShadowUser(self, open_order=None, callable_object=None,
argument_list=None, argument_dict=None):
"""
Restrict the security access of a method to the unaccessible shadow user
associated to the current user.
"""
if argument_list is None:
argument_list = []
if argument_dict is None:
argument_dict = {}
if open_order is None or callable_object is None:
raise TypeError('open_order and callable_object cannot be None')
relative_url = open_order.getRelativeUrl()
if open_order.getPortalType() != 'Open Sale Order':
raise Unauthorized("%s is not an Open Sale Order" % relative_url)
else:
# Check that open order is the validated one for the current user
if open_order.getValidationState() != 'validated':
raise Unauthorized('Open Sale Order %s is not validated.' % relative_url)
acl_users = open_order.getPortalObject().acl_users
# Switch to the shadow user temporarily, so that the behavior would not
# change even if this method is invoked by random users.
sm = getSecurityManager()
newSecurityManager(None, acl_users.getUserById(open_order.getReference()))
try:
return callable_object(*argument_list, **argument_dict)
finally:
# Restore the original user.
setSecurityManager(sm)
def getComputerSecurityCategory(self, base_category_list, user_name, def getComputerSecurityCategory(self, base_category_list, user_name,
object, portal_type): object, portal_type):
...@@ -82,7 +116,7 @@ def getSoftwareInstanceSecurityCategory(self, base_category_list, user_name, ...@@ -82,7 +116,7 @@ def getSoftwareInstanceSecurityCategory(self, base_category_list, user_name,
self.getPortalFutureInventoryStateList() + \ self.getPortalFutureInventoryStateList() + \
self.getPortalReservedInventoryStateList() + \ self.getPortalReservedInventoryStateList() + \
self.getPortalTransitInventoryStateList(), self.getPortalTransitInventoryStateList(),
sort_on=(('creation_date', 'DESC'),) sort_on=(('movement.start_date', 'DESC'),)
) )
if current_delivery_line is not None: if current_delivery_line is not None:
hosting_item = current_delivery_line.getAggregateValue(portal_type='Hosting Subscription') hosting_item = current_delivery_line.getAggregateValue(portal_type='Hosting Subscription')
...@@ -94,3 +128,4 @@ def getSoftwareInstanceSecurityCategory(self, base_category_list, user_name, ...@@ -94,3 +128,4 @@ def getSoftwareInstanceSecurityCategory(self, base_category_list, user_name,
"with reference %r" % user_name "with reference %r" % user_name
return category_list return category_list
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
<role id='R-COMPUTER'> <role id='R-COMPUTER'>
<item>Auditor</item> <item>Auditor</item>
</role> </role>
<role id='R-INSTANCE'>
<item>Auditor</item>
</role>
<role id='R-MEMBER'> <role id='R-MEMBER'>
<item>Auditor</item> <item>Auditor</item>
<item>Author</item> <item>Author</item>
</role> </role>
<role id='R-SHADOW'>
<item>Auditor</item>
</role>
<role id='devel'> <role id='devel'>
<item>Owner</item> <item>Owner</item>
</role> </role>
......
...@@ -3,15 +3,6 @@ ...@@ -3,15 +3,6 @@
<role id='ERP5TypeTestCase'> <role id='ERP5TypeTestCase'>
<item>Owner</item> <item>Owner</item>
</role> </role>
<role id='R-COMPUTER'>
<item>Auditor</item>
</role>
<role id='R-INSTANCE'>
<item>Auditor</item>
</role>
<role id='R-MEMBER'>
<item>Auditor</item>
</role>
<role id='test_computer'> <role id='test_computer'>
<item>Assignor</item> <item>Assignor</item>
</role> </role>
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<role id='F-SALE_G-COMPANY'> <role id='F-SALE_G-COMPANY'>
<item>Assignor</item> <item>Assignor</item>
</role> </role>
<role id='romain'>
<item>Owner</item>
</role>
<role id='test_hr_admin'> <role id='test_hr_admin'>
<item>Associate</item> <item>Associate</item>
</role> </role>
<role id='zope'>
<item>Owner</item>
</role>
</local_roles> </local_roles>
</local_roles_item> </local_roles_item>
\ No newline at end of file
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<role id='F-SALE_G-COMPANY'> <role id='F-SALE_G-COMPANY'>
<item>Assignor</item> <item>Assignor</item>
</role> </role>
<role id='romain'>
<item>Owner</item>
</role>
<role id='test_vifib_admin'> <role id='test_vifib_admin'>
<item>Associate</item> <item>Associate</item>
</role> </role>
<role id='zope'>
<item>Owner</item>
</role>
</local_roles> </local_roles>
</local_roles_item> </local_roles_item>
\ No newline at end of file
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<role id='F-SALE_G-COMPANY'> <role id='F-SALE_G-COMPANY'>
<item>Assignor</item> <item>Assignor</item>
</role> </role>
<role id='romain'>
<item>Owner</item>
</role>
<role id='test_vifib_customer'> <role id='test_vifib_customer'>
<item>Associate</item> <item>Associate</item>
</role> </role>
<role id='zope'>
<item>Owner</item>
</role>
</local_roles> </local_roles>
</local_roles_item> </local_roles_item>
\ No newline at end of file
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<role id='F-SALE_G-COMPANY'> <role id='F-SALE_G-COMPANY'>
<item>Assignor</item> <item>Assignor</item>
</role> </role>
<role id='supergabriel'>
<item>Owner</item>
</role>
<role id='test_vifib_customer_a'> <role id='test_vifib_customer_a'>
<item>Associate</item> <item>Associate</item>
</role> </role>
<role id='zope'>
<item>Owner</item>
</role>
</local_roles> </local_roles>
</local_roles_item> </local_roles_item>
\ No newline at end of file
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<role id='F-SALE_G-COMPANY'> <role id='F-SALE_G-COMPANY'>
<item>Assignor</item> <item>Assignor</item>
</role> </role>
<role id='romain'>
<item>Owner</item>
</role>
<role id='test_vifib_developer'> <role id='test_vifib_developer'>
<item>Associate</item> <item>Associate</item>
</role> </role>
<role id='zope'>
<item>Owner</item>
</role>
</local_roles> </local_roles>
</local_roles_item> </local_roles_item>
\ No newline at end of file
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<role id='F-SALE_G-COMPANY'> <role id='F-SALE_G-COMPANY'>
<item>Assignor</item> <item>Assignor</item>
</role> </role>
<role id='romain'>
<item>Owner</item>
</role>
<role id='test_vifib_member'> <role id='test_vifib_member'>
<item>Associate</item> <item>Associate</item>
</role> </role>
<role id='zope'>
<item>Owner</item>
</role>
</local_roles> </local_roles>
</local_roles_item> </local_roles_item>
\ No newline at end of file
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<role id='F-SALE_G-COMPANY'> <role id='F-SALE_G-COMPANY'>
<item>Assignor</item> <item>Assignor</item>
</role> </role>
<role id='romain'>
<item>Owner</item>
</role>
<role id='test_vifib_user_admin'> <role id='test_vifib_user_admin'>
<item>Associate</item> <item>Associate</item>
</role> </role>
<role id='zope'>
<item>Owner</item>
</role>
</local_roles> </local_roles>
</local_roles_item> </local_roles_item>
\ No newline at end of file
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
<role id='F-SALE_G-COMPANY'> <role id='F-SALE_G-COMPANY'>
<item>Assignor</item> <item>Assignor</item>
</role> </role>
<role id='romain'>
<item>Owner</item>
</role>
<role id='test_vifib_user_developer'> <role id='test_vifib_user_developer'>
<item>Associate</item> <item>Associate</item>
</role> </role>
<role id='zope'>
<item>Owner</item>
</role>
</local_roles> </local_roles>
</local_roles_item> </local_roles_item>
\ No newline at end of file
<local_roles_item> <local_roles_item>
<local_roles> <local_roles>
<role id='R-COMPUTER'> <role id='R-INSTANCE'>
<item>Auditor</item> <item>Auditor</item>
</role> </role>
<role id='R-MEMBER'> <role id='R-MEMBER'>
......
...@@ -3,8 +3,5 @@ ...@@ -3,8 +3,5 @@
<role id='ERP5TypeTestCase'> <role id='ERP5TypeTestCase'>
<item>Owner</item> <item>Owner</item>
</role> </role>
<role id='R-COMPUTER'>
<item>Auditor</item>
</role>
</local_roles> </local_roles>
</local_roles_item> </local_roles_item>
\ No newline at end of file
...@@ -89,10 +89,6 @@ ...@@ -89,10 +89,6 @@
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test_hr_admin</string> </value> <value> <string>test_hr_admin</string> </value>
</item> </item>
<item>
<key> <string>last_id</string> </key>
<value> <string>2</string> </value>
</item>
<item> <item>
<key> <string>last_name</string> </key> <key> <string>last_name</string> </key>
<value> <string>HR Administrator</string> </value> <value> <string>HR Administrator</string> </value>
......
...@@ -48,10 +48,6 @@ ...@@ -48,10 +48,6 @@
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test_vifib_admin</string> </value> <value> <string>test_vifib_admin</string> </value>
</item> </item>
<item>
<key> <string>last_id</string> </key>
<value> <string>2</string> </value>
</item>
<item> <item>
<key> <string>last_name</string> </key> <key> <string>last_name</string> </key>
<value> <string>Admin</string> </value> <value> <string>Admin</string> </value>
......
...@@ -94,10 +94,6 @@ ...@@ -94,10 +94,6 @@
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test_vifib_customer</string> </value> <value> <string>test_vifib_customer</string> </value>
</item> </item>
<item>
<key> <string>last_id</string> </key>
<value> <string>1</string> </value>
</item>
<item> <item>
<key> <string>last_name</string> </key> <key> <string>last_name</string> </key>
<value> <string>Customer</string> </value> <value> <string>Customer</string> </value>
......
...@@ -110,10 +110,6 @@ ...@@ -110,10 +110,6 @@
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test_vifib_customer_a</string> </value> <value> <string>test_vifib_customer_a</string> </value>
</item> </item>
<item>
<key> <string>last_id</string> </key>
<value> <string>1</string> </value>
</item>
<item> <item>
<key> <string>last_name</string> </key> <key> <string>last_name</string> </key>
<value> <string>Vifib Customer A</string> </value> <value> <string>Vifib Customer A</string> </value>
......
...@@ -94,10 +94,6 @@ ...@@ -94,10 +94,6 @@
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test_vifib_developer</string> </value> <value> <string>test_vifib_developer</string> </value>
</item> </item>
<item>
<key> <string>last_id</string> </key>
<value> <string>2</string> </value>
</item>
<item> <item>
<key> <string>last_name</string> </key> <key> <string>last_name</string> </key>
<value> <string>Developper</string> </value> <value> <string>Developper</string> </value>
......
...@@ -48,10 +48,6 @@ ...@@ -48,10 +48,6 @@
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test_vifib_member</string> </value> <value> <string>test_vifib_member</string> </value>
</item> </item>
<item>
<key> <string>last_id</string> </key>
<value> <string>2</string> </value>
</item>
<item> <item>
<key> <string>last_name</string> </key> <key> <string>last_name</string> </key>
<value> <string>Vifib Member</string> </value> <value> <string>Vifib Member</string> </value>
......
...@@ -83,10 +83,6 @@ ...@@ -83,10 +83,6 @@
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test_vifib_user_admin</string> </value> <value> <string>test_vifib_user_admin</string> </value>
</item> </item>
<item>
<key> <string>last_id</string> </key>
<value> <string>1</string> </value>
</item>
<item> <item>
<key> <string>last_name</string> </key> <key> <string>last_name</string> </key>
<value> <string>User Admin</string> </value> <value> <string>User Admin</string> </value>
......
...@@ -94,10 +94,6 @@ ...@@ -94,10 +94,6 @@
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test_vifib_user_developer</string> </value> <value> <string>test_vifib_user_developer</string> </value>
</item> </item>
<item>
<key> <string>last_id</string> </key>
<value> <string>1</string> </value>
</item>
<item> <item>
<key> <string>last_name</string> </key> <key> <string>last_name</string> </key>
<value> <string>User Developer</string> </value> <value> <string>User Developer</string> </value>
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
<multi_property id='category'>role/computer</multi_property> <multi_property id='category'>role/computer</multi_property>
<multi_property id='base_category'>role</multi_property> <multi_property id='base_category'>role</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>Instance</property>
<multi_property id='category'>role/instance</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
<role id='Auditor; Author'> <role id='Auditor; Author'>
<property id='title'>Member</property> <property id='title'>Member</property>
<multi_property id='category'>role/member</multi_property> <multi_property id='category'>role/member</multi_property>
<multi_property id='base_category'>role</multi_property> <multi_property id='base_category'>role</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>Shadow</property>
<multi_property id='category'>role/shadow</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
<type_roles>
<role id='Auditor'>
<property id='title'>Customer of the partition</property>
<property id='condition'>python: here.getSlapState() == "busy"</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByPerson</property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Software Instance related by Hosting Subscription</property>
<property id='condition'>python: here.getSlapState() == "busy"</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByHostingSubscription</property>
<multi_property id='base_category'>aggregate</multi_property>
</role>
</type_roles>
\ No newline at end of file
<type_roles> <type_roles>
<role id='Auditor'>
<property id='title'>Computer</property>
<property id='condition'>python: context.getReference("") != ""</property>
<multi_property id='category'>role/computer</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Computer Agent</property> <property id='title'>Computer Agent</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
...@@ -12,16 +6,10 @@ ...@@ -12,16 +6,10 @@
<multi_property id='base_category'>source_administration</multi_property> <multi_property id='base_category'>source_administration</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Instance</property> <property id='title'>Sale Trade Condition allocation</property>
<property id='condition'>python: context.getReference("") != ""</property> <property id='condition'>python: here.getAllocationScope('').startswith('open')</property>
<multi_property id='category'>role/instance</multi_property> <property id='base_category_script'>ComputerType_getSecurityCategoryFromSaleTradeCondition</property>
<multi_property id='base_category'>role</multi_property> <multi_property id='base_category'>aggregate</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Member</property>
<property id='condition'>python: context.getReference("") != ""</property>
<multi_property id='category'>role/member</multi_property>
<multi_property id='base_category'>role</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Self Computer</property> <property id='title'>Self Computer</property>
......
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByComputerPartition</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByComputerPartition</property>
<multi_property id='base_category'>aggregate</multi_property> <multi_property id='base_category'>aggregate</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>Customer of the Hosting Subscription</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByPerson</property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Related Software Instance Group</property> <property id='title'>Related Software Instance Group</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromSelf</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromSelf</property>
......
...@@ -5,4 +5,16 @@ ...@@ -5,4 +5,16 @@
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='base_category'>destination_decision</multi_property> <multi_property id='base_category'>destination_decision</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>Hosting Subscription related by self Lines</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromMovementItemByHostingSubscription</property>
<multi_property id='base_category'>aggregate</multi_property>
</role>
<role id='Auditor; Assignor'>
<property id='title'>Vifib Production Manager</property>
<multi_property id='category'>function/production</multi_property>
<multi_property id='category'>group/company</multi_property>
<multi_property id='base_category'>function</multi_property>
<multi_property id='base_category'>group</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -11,6 +11,12 @@ ...@@ -11,6 +11,12 @@
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='base_category'>destination_decision</multi_property> <multi_property id='base_category'>destination_decision</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>Destination Section</property>
<property id='description'>Monovalued role</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Software Instance User become Auditor of Sale Packing List related to Slave Instance</property> <property id='title'>Software Instance User become Auditor of Sale Packing List related to Slave Instance</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
......
<type_roles> <type_roles>
<role id='Auditor'>
<property id='title'>Computer</property>
<multi_property id='category'>role/computer</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
<role id='Auditor; Author'> <role id='Auditor; Author'>
<property id='title'>Member</property> <property id='title'>Member</property>
<multi_property id='category'>role/member</multi_property> <multi_property id='category'>role/member</multi_property>
<multi_property id='base_category'>role</multi_property> <multi_property id='base_category'>role</multi_property>
</role> </role>
<role id='Auditor'>
<property id='title'>Member</property>
<multi_property id='category'>role/instance</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
</type_roles> </type_roles>
\ No newline at end of file
<type_roles> <type_roles>
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Computer</property> <property id='title'>Friends of the trade condition</property>
<multi_property id='category'>role/computer</multi_property> <property id='condition'>python: (here.getValidationState() == 'validated') and (here.getDestinationSection('') != '')</property>
<property id='base_category_script'>SaleTradeConditionType_getSecurityCategoryFromOpenSaleOrder</property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Instance</property>
<property id='condition'>python: (here.getValidationState() == 'validated') and (here.getDestinationSection('') == '')</property>
<multi_property id='category'>role/instance</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Member</property>
<property id='condition'>python: (here.getValidationState() == 'validated') and (here.getDestinationSection('') == '')</property>
<multi_property id='category'>role/member</multi_property>
<multi_property id='base_category'>role</multi_property> <multi_property id='base_category'>role</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Customer</property> <property id='title'>Provider of the trade condition</property>
<property id='condition'>python: (here.getValidationState() == 'validated') and (here.getSourceSection('') != '')</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromContent</property>
<multi_property id='base_category'>destination_section</multi_property> <multi_property id='base_category'>source_section</multi_property>
</role> </role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -4,8 +4,14 @@ ...@@ -4,8 +4,14 @@
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByComputerPartition</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByComputerPartition</property>
<multi_property id='base_category'>aggregate</multi_property> <multi_property id='base_category'>aggregate</multi_property>
</role> </role>
<role id='Assignee'>
<property id='title'>Customer of the Instance</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByPerson</property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Owner become Assignee</property> <property id='title'>Owner become Assignee</property>
<property id='description'>XXX Needed to allow doActionFor while creating the document</property>
<property id='base_category_script'>ERP5Type_acquireSecurityFromOwner</property> <property id='base_category_script'>ERP5Type_acquireSecurityFromOwner</property>
<multi_property id='base_category'>source</multi_property> <multi_property id='base_category'>source</multi_property>
</role> </role>
......
...@@ -4,8 +4,14 @@ ...@@ -4,8 +4,14 @@
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByComputerPartition</property> <property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByComputerPartition</property>
<multi_property id='base_category'>aggregate</multi_property> <multi_property id='base_category'>aggregate</multi_property>
</role> </role>
<role id='Assignee'>
<property id='title'>Customer of the Instance</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByPerson</property>
<multi_property id='base_category'>destination_section</multi_property>
</role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Owner become Assignee</property> <property id='title'>Owner become Assignee</property>
<property id='description'>XXX Needed to allow doActionFor while creating the document</property>
<property id='base_category_script'>ERP5Type_acquireSecurityFromOwner</property> <property id='base_category_script'>ERP5Type_acquireSecurityFromOwner</property>
<multi_property id='base_category'>source</multi_property> <multi_property id='base_category'>source</multi_property>
</role> </role>
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
<type>Open Sale Order</type> <type>Open Sale Order</type>
<workflow>local_permission_vifib_interaction_workflow</workflow> <workflow>local_permission_vifib_interaction_workflow</workflow>
</chain> </chain>
<chain>
<type>Open Sale Order Module</type>
<workflow>init_vifib_interaction_workflow</workflow>
</chain>
<chain> <chain>
<type>Person</type> <type>Person</type>
<workflow>local_permission_vifib_interaction_workflow</workflow> <workflow>local_permission_vifib_interaction_workflow</workflow>
...@@ -47,6 +51,10 @@ ...@@ -47,6 +51,10 @@
<type>Sale Trade Condition</type> <type>Sale Trade Condition</type>
<workflow>local_permission_vifib_interaction_workflow</workflow> <workflow>local_permission_vifib_interaction_workflow</workflow>
</chain> </chain>
<chain>
<type>Sale Trade Condition Module</type>
<workflow>init_vifib_interaction_workflow</workflow>
</chain>
<chain> <chain>
<type>Slave Instance</type> <type>Slave Instance</type>
<workflow>local_permission_vifib_interaction_workflow</workflow> <workflow>local_permission_vifib_interaction_workflow</workflow>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># XXX For now, this script requires proxy manager\n
\n
# base_category_list : list of category values we need to retrieve\n
# user_name : string obtained from getSecurityManager().getUser().getUserName() [NuxUserGroup]\n
# or from getSecurityManager().getUser().getId() [PluggableAuthService with ERP5GroupManager]\n
# object : object which we want to assign roles to.\n
# portal_type : portal type of object\n
\n
# must always return a list of dicts\n
\n
if obj is None:\n
return []\n
\n
portal = obj.getPortalObject()\n
\n
sale_supply_line_list = portal.portal_catalog(\n
aggregate_relative_url=obj.getRelativeUrl(),\n
portal_type="Sale Supply Line",\n
validation_state="validated")\n
\n
category_list = []\n
public = 0\n
\n
for sale_supply_line in sale_supply_line_list:\n
sale_supply_line = sale_supply_line.getObject()\n
sale_trade_condition = sale_supply_line.getParentValue()\n
if sale_trade_condition.getPortalType() == \'Sale Trade Condition\':\n
\n
person_list = sale_supply_line.getDestinationSectionValueList(portal_type="Person")\n
if person_list:\n
for person in person_list:\n
category_list.extend([x.getReference() for x in person.portal_catalog(\n
portal_type="Open Sale Order",\n
validation_state="validated",\n
destination_decision_relative_url=person.getRelativeUrl())])\n
else:\n
# Global\n
public = 1\n
break\n
\n
if public:\n
return {"Auditor": ["R-SHADOW"]}\n
elif category_list:\n
return {"Auditor": ["SHADOW-%s" % x for x in category_list]}\n
else:\n
return []\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputerType_getSecurityCategoryFromSaleTradeCondition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># XXX For now, this script requires proxy manager\n
\n
# base_category_list : list of category values we need to retrieve\n
# user_name : string obtained from getSecurityManager().getUser().getUserName() [NuxUserGroup]\n
# or from getSecurityManager().getUser().getId() [PluggableAuthService with ERP5GroupManager]\n
# object : object which we want to assign roles to.\n
# portal_type : portal type of object\n
\n
# must always return a list of dicts\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\n
if obj.getPortalType() in ["Person", "Software Instance"]:\n
return [{"role": [\'role/open_order\']}]\n
return []\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Type_getSecurityCategoryForPersonSoftwareInstance</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
# XXX For now, this script requires proxy manager\n
\n
# base_category_list : list of category values we need to retrieve\n
# user_name : string obtained from getSecurityManager().getUser().getUserName() [NuxUserGroup]\n
# or from getSecurityManager().getUser().getId() [PluggableAuthService with ERP5GroupManager]\n
# object : object which we want to assign roles to.\n
# portal_type : portal type of object\n
\n
# must always return a list of dicts\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\n
movement_portal_type = "Sale Packing List Line"\n
\n
portal = obj.getPortalObject()\n
\n
security_dict = {}\n
\n
parent_url_list = []\n
for movement in portal.portal_catalog(\n
portal_type=movement_portal_type,\n
aggregate_uid=obj.getUid(),\n
simulation_state=portal.getPortalCurrentInventoryStateList() + portal.getPortalReservedInventoryStateList() + portal.getPortalTransitInventoryStateList(),\n
):\n
item = movement.getDestinationSectionValue(portal_type="Person")\n
if item is not None:\n
parent_url_list.append(item.getRelativeUrl())\n
\n
if len(parent_url_list) > 0:\n
parent_url_list.sort()\n
category_list.append({"destination_section": parent_url_list})\n
return category_list\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Type_getSecurityCategoryFromAggregateMovementItemByPerson</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -66,8 +66,11 @@ if obj is None:\n ...@@ -66,8 +66,11 @@ if obj is None:\n
return []\n return []\n
\n \n
item_portal_type = "Hosting Subscription"\n item_portal_type = "Hosting Subscription"\n
\n if obj.getPortalType() == \'Open Sale Order\':\n
for movement in obj.getMovementList():\n movement_list = obj.contentValues(portal_type=\'Open Sale Order Line\')\n
else:\n
movement_list = obj.getMovementList()\n
for movement in movement_list:\n
item = movement.getAggregateValue(portal_type=item_portal_type)\n item = movement.getAggregateValue(portal_type=item_portal_type)\n
if item is not None:\n if item is not None:\n
category_list.append({"aggregate": [item.getRelativeUrl()]})\n category_list.append({"aggregate": [item.getRelativeUrl()]})\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># XXX For now, this script requires proxy manager\n
\n
# base_category_list : list of category values we need to retrieve\n
# user_name : string obtained from getSecurityManager().getUser().getUserName() [NuxUserGroup]\n
# or from getSecurityManager().getUser().getId() [PluggableAuthService with ERP5GroupManager]\n
# object : object which we want to assign roles to.\n
# portal_type : portal type of object\n
\n
# must always return a list of dicts\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\n
if obj.getPortalType() == \'Person\':\n
open_sale_order = obj.getDestinationSectionRelatedValue(portal_type=\'Open Sale Order\')\n
if open_sale_order is not None and open_sale_order.getValidationState() == \'validated\':\n
return [{\'aggregate\': open_sale_order.getRelativeUrl()}]\n
\n
if obj.getPortalType() == \'Software Instance\':\n
delivery_line = obj.getAggregateRelatedValue(portal_type=\'Sale Packing List Line\')\n
if delivery_line is not None:\n
hosting_subscription = delivery_line.getAggregateValue(portal_type=\'Hosting Subscription\')\n
if hosting_subscription is not None:\n
open_sale_order_line = hosting_subscription.getAggregateRelatedValue(portal_type=\'Open Sale Order Line\')\n
if open_sale_order_line is not None and open_sale_order_line.getParentValue().getValidationState() == \'validated\':\n
return [{\'aggregate\': open_sale_order_line.getParentValue().getRelativeUrl()}]\n
\n
return []\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Type_getSecurityCategoryFromRelatedOpenOrder</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -62,7 +62,7 @@ return (\n ...@@ -62,7 +62,7 @@ return (\n
# Person security\n # Person security\n
(\'ERP5Type_getSecurityCategoryFromAssignment\', [\'function\', \'group\']),\n (\'ERP5Type_getSecurityCategoryFromAssignment\', [\'function\', \'group\']),\n
(\'ERP5Type_getSecurityCategoryFromAssignment\', [\'role\']),\n (\'ERP5Type_getSecurityCategoryFromAssignment\', [\'role\']),\n
(\'ERP5Type_getPersonSecurityFromHostingSubscription\', [\'aggregate\']),\n # (\'ERP5Type_getPersonSecurityFromHostingSubscription\', [\'aggregate\']),\n
\n \n
# Computer security\n # Computer security\n
(\'ERP5Type_getComputerSecurityCategory\', [\'role\']),\n (\'ERP5Type_getComputerSecurityCategory\', [\'role\']),\n
...@@ -70,6 +70,11 @@ return (\n ...@@ -70,6 +70,11 @@ return (\n
# Instance security\n # Instance security\n
(\'ERP5Type_getSoftwareInstanceSecurityCategory\', [\'role\']),\n (\'ERP5Type_getSoftwareInstanceSecurityCategory\', [\'role\']),\n
(\'ERP5Type_getSoftwareInstanceSecurityCategory\', [\'aggregate\']),\n (\'ERP5Type_getSoftwareInstanceSecurityCategory\', [\'aggregate\']),\n
\n
# Person + Instance additional secutity\n
(\'ERP5Type_getSecurityCategoryForPersonSoftwareInstance\', [\'role\']),\n
(\'ERP5Type_getSecurityCategoryFromRelatedOpenOrder\', [\'aggregate\']),\n
\n
)\n )\n
</string> </value> </string> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>restrictMethodAsShadowUser</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>VifibSecurity</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>OpenSaleOrder_restrictMethodAsShadowUser</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># XXX For now, this script requires proxy manager\n
\n
# base_category_list : list of category values we need to retrieve\n
# user_name : string obtained from getSecurityManager().getUser().getUserName() [NuxUserGroup]\n
# or from getSecurityManager().getUser().getId() [PluggableAuthService with ERP5GroupManager]\n
# object : object which we want to assign roles to.\n
# portal_type : portal type of object\n
\n
# must always return a list of dicts\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\n
portal = obj.getPortalObject()\n
person_list = []\n
person_list.extend(obj.getDestinationSectionValueList(portal_type="Person"))\n
\n
for person in person_list:\n
for open_order in portal.portal_catalog(\n
portal_type="Open Sale Order",\n
validation_state="validated",\n
destination_decision_relative_url=person.getRelativeUrl()):\n
category_list.append(open_order)\n
\n
if category_list:\n
return {"Auditor": [x.getReference() for x in category_list]}\n
else:\n
return []\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleTradeConditionType_getSecurityCategoryFromOpenSaleOrder</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionWorkflowDefinition" module="Products.ERP5.InteractionWorkflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>creation_guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>init_vifib_interaction_workflow</string> </value>
</item>
<item>
<key> <string>manager_bypass</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Init script Interaction Workflow</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interaction" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interactions</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<list>
<string>SaleTradeCondition_newContent</string>
</list>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleTradeCondition_newContent</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>newContent</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Sale Trade Condition Module</string>
</list>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Scripts" module="Products.DCWorkflow.Scripts"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>scripts</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>sale_trade_condition = state_change[\'kwargs\'][\'workflow_method_result\']\n
\n
short_portal_type = "STC"\n
id_group = ("vifib", "reference", short_portal_type)\n
default = 1\n
reference = sale_trade_condition.portal_ids.generateNewId(id_group=id_group,\n
default=default)\n
\n
sale_trade_condition.edit(\n
reference=\'%s_%s\' % (short_portal_type, reference),\n
)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleTradeCondition_newContent</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Variables" module="Products.DCWorkflow.Variables"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>variables</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Worklists" module="Products.DCWorkflow.Worklists"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>worklists</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<list>
<string>Base_updateAllLocalRoles</string>
</list>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_manipulateContent</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>newContent</string>
<string>manage_afterDelete</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Open Sale Order</string>
</list>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -27,15 +27,15 @@ ...@@ -27,15 +27,15 @@
<item> <item>
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <value>
<list> <tuple/>
<string>Base_updateAllLocalRoles</string>
</list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>before_commit_script_name</string> </key> <key> <string>before_commit_script_name</string> </key>
<value> <value>
<tuple/> <list>
<string>Base_updateAllLocalRoles</string>
</list>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -27,15 +27,16 @@ ...@@ -27,15 +27,16 @@
<item> <item>
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <value>
<list> <tuple/>
<string>Base_updateAllLocalRoles</string>
</list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>before_commit_script_name</string> </key> <key> <string>before_commit_script_name</string> </key>
<value> <value>
<tuple/> <list>
<string>Base_updateAllLocalRoles</string>
<string>SaleTradeCondition_updateComputerLocalRoles</string>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -57,6 +58,9 @@ ...@@ -57,6 +58,9 @@
<value> <value>
<list> <list>
<string>_setDestinationSection.*</string> <string>_setDestinationSection.*</string>
<string>_setSourceSection.*</string>
<string>validate</string>
<string>invalidate</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>once_per_transaction</string> </key> <key> <string>once_per_transaction</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>portal_type_filter</string> </key> <key> <string>portal_type_filter</string> </key>
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
</item> </item>
<item> <item>
<key> <string>temporary_document_disallowed</string> </key> <key> <string>temporary_document_disallowed</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<list>
<string>Base_updateAllLocalRoles</string>
</list>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Computer_setAllocationScope</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>_setAllocationScope.*</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Computer</string>
</list>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>once_per_transaction</string> </key> <key> <string>once_per_transaction</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>portal_type_filter</string> </key> <key> <string>portal_type_filter</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<list>
<string>OpenSaleOrder_updateSaleTradeConditionLocalRoles</string>
</list>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>OpenSaleOrder_edit</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>_setReference</string>
<string>validate</string>
<string>invalidate</string>
<string>_setDestinationDecision.*</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Open Sale Order</string>
</list>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>once_per_transaction</string> </key> <key> <string>once_per_transaction</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>portal_type_filter</string> </key> <key> <string>portal_type_filter</string> </key>
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
</item> </item>
<item> <item>
<key> <string>temporary_document_disallowed</string> </key> <key> <string>temporary_document_disallowed</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<list>
<string>SaleTradeCondition_updateDestinationSection</string>
</list>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleTradeCondition_setSubjectList</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>_setSubjectList</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Sale Trade Condition</string>
</list>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>open_sale_order = state_change[\'object\']\n
\n
person = open_sale_order.getDestinationSectionValue()\n
for sale_supply_line in person.portal_catalog(\n
destination_section_relative_url=person.getRelativeUrl(), portal_type="Sale Supply Line", validation_state="validated"):\n
sale_trade_condition = sale_supply_line.getParentValue()\n
if sale_trade_condition.getPortalType() == "Sale Trade Condition":\n
sale_trade_condition.activate(after_path_and_method_id=(open_sale_order.getPath(), (\'immediateReindexObject\', \'recursiveImmediateReindexObject\')),).updateLocalRolesOnSecurityGroups()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>OpenSaleOrder_updateSaleTradeConditionLocalRoles</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -54,10 +54,13 @@ ...@@ -54,10 +54,13 @@
This script updates all local roles on the object. It requires Assignor\n This script updates all local roles on the object. It requires Assignor\n
proxy role since it may be called by owner in draft state.\n proxy role since it may be called by owner in draft state.\n
"""\n """\n
portal_type_list = ["Software Instance", "Slave Instance", "Hosting Subscription"]\n portal_type_list = ["Software Instance", "Slave Instance", "Hosting Subscription", "Computer Partition"]\n
for movement in state_change[\'object\'].getMovementList():\n for movement in state_change[\'object\'].getMovementList():\n
tag = "softinssec_%s" % movement.getUid()\n tag = "softinssec_%s" % movement.getUid()\n
movement.activate(tag=tag).immediateReindexObject()\n movement.activate(activity=\'SQLQueue\', tag=tag, after_path_and_method_id=(movement.getPath(),\n
(\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).serialize()\n
movement.activate(activity=\'SQLQueue\', tag=tag, after_path_and_method_id=(movement.getParentValue().getPath(),\n
(\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).serialize()\n
for software_instance in movement.getAggregateValueList(portal_type=portal_type_list):\n for software_instance in movement.getAggregateValueList(portal_type=portal_type_list):\n
software_instance.activate(after_tag=tag).updateLocalRolesOnSecurityGroups()\n software_instance.activate(after_tag=tag).updateLocalRolesOnSecurityGroups()\n
</string> </value> </string> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>sale_trade_condition = state_change[\'object\']\n
\n
for sale_supply_line in sale_trade_condition.contentValues(portal_type="Sale Supply Line"):\n
for computer in sale_supply_line.getAggregateValueList(portal_type="Computer"):\n
tag = \'%s_related_document_reindex\' % computer.getPath()\n
computer.activate(activity=\'SQLQueue\', tag=tag, after_path_and_method_id=(sale_trade_condition.getPath(),\n
(\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))\n
).serialize()\n
computer.activate(activity=\'SQLQueue\', tag=tag, after_path_and_method_id=(sale_supply_line.getPath(),\n
(\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))\n
).serialize()\n
computer.activate(activity=\'SQLQueue\', tag=tag, after_path_and_method_id=(computer.getPath(),\n
(\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))\n
).serialize()\n
computer.activate(after_tag=tag).updateLocalRolesOnSecurityGroups()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleTradeCondition_updateComputerLocalRoles</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -50,33 +50,36 @@ ...@@ -50,33 +50,36 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>sale_packing_list = state_change[\'object\']\n <value> <string>sale_trade_condition = state_change[\'object\']\n
portal = sale_trade_condition.getPortalObject()\n
\n \n
sale_order = sale_packing_list.getCausalityValue(portal_type="Sale Order")\n subject_list = sale_trade_condition.getSubjectList()\n
if sale_order is None:\n person_list = []\n
setup_service_relative_url = sale_packing_list.portal_preferences.getPreferredInstanceSetupResource()\n
\n \n
for sale_packing_list_line in sale_packing_list.contentValues(\n for subject in subject_list:\n
portal_type="Sale Packing List Line"):\n if subject:\n
if sale_packing_list_line.getResource() == setup_service_relative_url:\n result_list = portal.portal_catalog(limit=2, validation_state="validated", portal_type="Person", default_email_text=subject)\n
computer_partition = sale_packing_list_line.getAggregateValue(portal_type=["Computer Partition"])\n if len(result_list) == 1:\n
if computer_partition is None:\n person_list.append(result_list[0].getObject())\n
raise ValueError("Sale Packing List Line \'%s\' should have a computer partition aggregated" % sale_packing_list_line.getRelativeUrl())\n \n
else:\n sale_trade_condition.edit(destination_section_value_list=person_list)\n
# Slave instance do not change state of computer partitions.\n
if sale_packing_list_line.getAggregateValue(portal_type=["Slave Instance"]) is None:\n
# Mark computer partition as busy\n
# This method should be always callable in this step to prevent having 2 packing list related to the same computer partition\n
computer_partition.markBusy()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>state_change</string> </value> <value> <string>state_change</string> </value>
</item> </item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SalePackingList_markComputerPartitionBusy</string> </value> <value> <string>SaleTradeCondition_updateDestinationSection</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
237 288
\ No newline at end of file \ No newline at end of file
...@@ -8,6 +8,7 @@ Campaign ...@@ -8,6 +8,7 @@ Campaign
Campaign Module Campaign Module
Computer Computer
Computer Module Computer Module
Computer Partition
Credential Update Module Credential Update Module
Currency Currency
Currency Module Currency Module
......
...@@ -8,6 +8,7 @@ Campaign ...@@ -8,6 +8,7 @@ Campaign
Campaign Module Campaign Module
Computer Computer
Computer Module Computer Module
Computer Partition
Credential Update Module Credential Update Module
Currency Currency
Currency Module Currency Module
......
Computer | local_permission_vifib_interaction_workflow Computer | local_permission_vifib_interaction_workflow
Hosting Subscription | local_permission_vifib_interaction_workflow Hosting Subscription | local_permission_vifib_interaction_workflow
Internal Packing List | local_permission_vifib_interaction_workflow Internal Packing List | local_permission_vifib_interaction_workflow
Open Sale Order Module | init_vifib_interaction_workflow
Open Sale Order | local_permission_vifib_interaction_workflow Open Sale Order | local_permission_vifib_interaction_workflow
Person | local_permission_vifib_interaction_workflow Person | local_permission_vifib_interaction_workflow
Purchase Packing List Line | local_permission_vifib_interaction_workflow Purchase Packing List Line | local_permission_vifib_interaction_workflow
...@@ -9,6 +10,7 @@ Sale Order Line | local_permission_vifib_interaction_workflow ...@@ -9,6 +10,7 @@ Sale Order Line | local_permission_vifib_interaction_workflow
Sale Order | local_permission_vifib_interaction_workflow Sale Order | local_permission_vifib_interaction_workflow
Sale Packing List Line | local_permission_vifib_interaction_workflow Sale Packing List Line | local_permission_vifib_interaction_workflow
Sale Packing List | local_permission_vifib_interaction_workflow Sale Packing List | local_permission_vifib_interaction_workflow
Sale Trade Condition Module | init_vifib_interaction_workflow
Sale Trade Condition | local_permission_vifib_interaction_workflow Sale Trade Condition | local_permission_vifib_interaction_workflow
Slave Instance | local_permission_vifib_interaction_workflow Slave Instance | local_permission_vifib_interaction_workflow
Software Instance | local_permission_vifib_interaction_workflow Software Instance | local_permission_vifib_interaction_workflow
\ No newline at end of file
init_vifib_interaction_workflow
local_permission_vifib_interaction_workflow local_permission_vifib_interaction_workflow
\ No newline at end of file
<catalog_method>
<item key="sql_catalog_object_list" type="int">
<value>1</value>
</item>
</catalog_method>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>uid\r\n
security_uid\r\n
getOwnerInfo\r\n
getViewPermissionOwner\r\n
getPath\r\n
getRelativeUrl\r\n
getParentUid\r\n
id\r\n
getDescription\r\n
getTitle\r\n
meta_type\r\n
getPortalType\r\n
getOpportunityState\r\n
getCorporateRegistrationCode\r\n
getEan13Code\r\n
getSimulationState\r\n
getCausalityState\r\n
getInvoiceState\r\n
getValidationState\r\n
getPaymentState\r\n
getEventState\r\n
getImmobilisationState\r\n
getReference\r\n
getGroupingReference\r\n
getSourceReference\r\n
getDestinationReference\r\n
getStringIndex\r\n
getIntIndex\r\n
getFloatIndex\r\n
hasCellContent</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_catalog_object_list</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
REPLACE INTO\n
catalog\n
(`uid`, `security_uid`, `owner`, `viewable_owner`, `path`, `relative_url`, `parent_uid`, `id`, `description`, `title`, `meta_type`,\n
`portal_type`, `opportunity_state`, `corporate_registration_code`, `ean13_code`, `validation_state`, `simulation_state`,\n
`causality_state`, `invoice_state`, `payment_state`, `event_state`, `immobilisation_state`, `reference`, `grouping_reference`,\n
`source_reference`, `destination_reference`, `string_index`, `int_index`, `float_index`, `has_cell_content`)\n
VALUES\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">\n
(\n
<dtml-sqlvar expr="uid[loop_item]" type="int">, \n
<dtml-sqlvar expr="security_uid[loop_item]" type="int">,\n
<dtml-sqlvar expr="getOwnerInfo[loop_item][\'id\']" type="string">,\n
<dtml-sqlvar expr="(getViewPermissionOwner[loop_item] is not None) and getViewPermissionOwner[loop_item] or \'\'" type="string" optional>,\n
<dtml-sqlvar expr="getPath[loop_item]" type="string">,\n
<dtml-sqlvar expr="getRelativeUrl[loop_item]" type="string">,\n
<dtml-sqlvar expr="getParentUid[loop_item]" type="int">,\n
<dtml-sqlvar expr="id[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getDescription[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getTitle[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="meta_type[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getPortalType[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getOpportunityState[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getCorporateRegistrationCode[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getEan13Code[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getValidationState[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getSimulationState[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getCausalityState[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getInvoiceState[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getPaymentState[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getEventState[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getImmobilisationState[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getReference[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getGroupingReference[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getSourceReference[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getDestinationReference[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getStringIndex[loop_item]" type="string" optional>,\n
<dtml-sqlvar expr="getIntIndex[loop_item]" type="int" optional>,\n
<dtml-sqlvar expr="getFloatIndex[loop_item]" type="float" optional>,\n
<dtml-sqlvar expr="hasCellContent[loop_item]" type="int" optional>\n
)\n
<dtml-if sequence-end><dtml-else>,</dtml-if>\n
</dtml-in>\n
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
29 30
\ No newline at end of file \ No newline at end of file
...@@ -4,6 +4,7 @@ erp5_mysql_innodb/z0_uncatalog_computer_partition ...@@ -4,6 +4,7 @@ erp5_mysql_innodb/z0_uncatalog_computer_partition
erp5_mysql_innodb/z0_uncatalog_software_instance erp5_mysql_innodb/z0_uncatalog_software_instance
erp5_mysql_innodb/z_catalog_computer_partition_list erp5_mysql_innodb/z_catalog_computer_partition_list
erp5_mysql_innodb/z_catalog_email_list erp5_mysql_innodb/z_catalog_email_list
erp5_mysql_innodb/z_catalog_object_list
erp5_mysql_innodb/z_catalog_software_instance_list erp5_mysql_innodb/z_catalog_software_instance_list
erp5_mysql_innodb/z_create_computer_partition erp5_mysql_innodb/z_create_computer_partition
erp5_mysql_innodb/z_create_software_instance_tree erp5_mysql_innodb/z_create_software_instance_tree
......
...@@ -77,10 +77,11 @@ if custom_trade_condition is None:\n ...@@ -77,10 +77,11 @@ if custom_trade_condition is None:\n
custom_trade_condition = portal.sale_trade_condition_module.newContent(specialise_value=trade_condition,\n custom_trade_condition = portal.sale_trade_condition_module.newContent(specialise_value=trade_condition,\n
destination_section_uid=order.getDestinationSectionUid(),\n destination_section_uid=order.getDestinationSectionUid(),\n
title="ViFiB Custom Conditions")\n title="ViFiB Custom Conditions")\n
custom_trade_condition.validate()\n
\n \n
if order.getSpecialise() != custom_trade_condition.getRelativeUrl():\n if order.getSpecialise() != custom_trade_condition.getRelativeUrl():\n
order.setSpecialiseValue(custom_trade_condition, portal_type="Sale Trade Condition")\n order.setSpecialiseValue(custom_trade_condition, portal_type="Sale Trade Condition")\n
if portal.portal_workflow.isTransitionPossible(custom_trade_condition, \'validate\'):\n
custom_trade_condition.validate()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -52,36 +52,6 @@ ...@@ -52,36 +52,6 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n <value> <string>portal = context.getPortalObject()\n
\n \n
def checkSoftwareInstanceIsInstalledOnComputerPartition(software_release,\n
computer_partition):\n
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
resource_relative_url = (\n
portal.portal_preferences.getPreferredInstanceSetupResource(),\n
portal.portal_preferences.getPreferredInstanceHostingResource(),\n
)\n
query = ComplexQuery(Query(aggregate_relative_url=software_release.getRelativeUrl()),\n
Query(aggregate_relative_url=computer_partition.getRelativeUrl()),\n
operator="AND",\n
)\n
sale_packing_list_line_list = portal.portal_catalog(\n
portal_type=\'Sale Packing List Line\',\n
query=query,\n
resource_relative_url=resource_relative_url,\n
limit=1)\n
\n
if len(sale_packing_list_line_list) == 1:\n
resource_relative_url = (\n
portal.portal_preferences.getPreferredInstanceCleanupResource(),\n
)\n
sale_packing_list_line_list = portal.portal_catalog(\n
portal_type=\'Sale Packing List Line\',\n
query=query,\n
resource_relative_url=resource_relative_url,\n
limit=1)\n
if len(sale_packing_list_line_list) == 0:\n
return True\n
return False\n
\n
order = state_change[\'object\']\n order = state_change[\'object\']\n
\n \n
setup_service_relative_url = order.portal_preferences.getPreferredInstanceSetupResource()\n setup_service_relative_url = order.portal_preferences.getPreferredInstanceSetupResource()\n
...@@ -95,47 +65,21 @@ for order_line in order.getMovementList():\n ...@@ -95,47 +65,21 @@ for order_line in order.getMovementList():\n
software_release = order_line.getAggregateValue(portal_type="Software Release")\n software_release = order_line.getAggregateValue(portal_type="Software Release")\n
software_instance = order_line.getAggregateValue(portal_type=instance_portal_type_list)\n software_instance = order_line.getAggregateValue(portal_type=instance_portal_type_list)\n
\n \n
computer_partition = None\n hosting_subscription = order_line.getAggregateValue(portal_type="Hosting Subscription")\n
# XXX Duplicated from request method...\n open_order_line = portal.portal_catalog.getResultValue(\n
query_kw = {\n portal_type="Open Sale Order Line",\n
\'software_release_url\': software_release.getUrlString(),\n validation_state="validated",\n
\'portal_type\': \'Computer Partition\',\n aggregate_relative_url=hosting_subscription.getRelativeUrl(),\n
\'free_for_request\': 1,\n destination_section_relative_url=order.getDestinationSection())\n
}\n if open_order_line is not None:\n
if software_instance.getPortalType() == "Slave Instance":\n open_order = open_order_line.getParentValue()\n
query_kw[\'free_for_request\'] = 0\n computer_partition_relative_url = open_order.OpenSaleOrder_restrictMethodAsShadowUser(\n
\n open_order=open_order,\n
# support SLA\n callable_object=open_order.OpenSaleOrder_findPartition,\n
filter_kw = software_instance.getSlaXmlAsDict()\n argument_list=[software_release.getUrlString(), software_instance.getSourceReference(),\n
if "computer_guid" in filter_kw:\n software_instance.getPortalType(), software_instance.getSlaXmlAsDict()])\n
query_kw["parent_reference"] = filter_kw["computer_guid"]\n
\n
result_count = software_instance.portal_catalog.countResults(**query_kw)[0][0]\n
offset = max(0, result_count-1)\n
for computer_partition_candidate in portal.portal_catalog(\n
limit=(random.randint(0, offset), 50), **query_kw):\n
computer_partition_candidate = computer_partition_candidate.getObject() \n
# Check if the computer partition can be marked as busy (done by an interaction workflow on sale packing list level)\n
software_instance_portal_type = software_instance.getPortalType()\n
if isTransitionPossible(computer_partition_candidate, \'mark_busy\') and \\\n
software_instance_portal_type == "Software Instance":\n
computer_partition = computer_partition_candidate\n
break\n
elif software_instance_portal_type == "Slave Instance" and \\\n
checkSoftwareInstanceIsInstalledOnComputerPartition(software_release, computer_partition_candidate):\n
computer_partition = computer_partition_candidate\n
break\n
\n
if computer_partition is None:\n
raise ValueError(\'It was not possible to find free Computer Partition\')\n
\n
# lock computer partition\n
computer_partition.serialize()\n
if isTransitionPossible(computer_partition_candidate, \'mark_busy\'):\n
computer_partition.markBusy()\n
\n
order_line.edit(\n order_line.edit(\n
aggregate_list=order_line.getAggregateList()+[computer_partition.getRelativeUrl()])\n aggregate_list=order_line.getAggregateList()+[computer_partition_relative_url])\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
97 104
\ No newline at end of file \ No newline at end of file
<workflow_chain> <workflow_chain>
<chain>
<type>Assignment</type>
<workflow>slap_interaction_workflow</workflow>
</chain>
<chain> <chain>
<type>Computer</type> <type>Computer</type>
<workflow>computer_slap_interface_workflow, slap_interaction_workflow</workflow> <workflow>computer_slap_interface_workflow, slap_interaction_workflow</workflow>
......
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<key> <string>actbox_category</string> </key> <key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value> <value> <string>workflow</string> </value>
</item> </item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>actbox_name</string> </key> <key> <string>actbox_name</string> </key>
<value> <string>Mark Free</string> </value> <value> <string>Mark Free</string> </value>
...@@ -29,7 +33,7 @@ ...@@ -29,7 +33,7 @@
<item> <item>
<key> <string>guard</string> </key> <key> <string>guard</string> </key>
<value> <value>
<none/> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -55,4 +59,22 @@ ...@@ -55,4 +59,22 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>roles</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<key> <string>actbox_category</string> </key> <key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value> <value> <string>workflow</string> </value>
</item> </item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>actbox_name</string> </key> <key> <string>actbox_name</string> </key>
<value> <string>Mark Inactive</string> </value> <value> <string>Mark Inactive</string> </value>
...@@ -29,7 +33,7 @@ ...@@ -29,7 +33,7 @@
<item> <item>
<key> <string>guard</string> </key> <key> <string>guard</string> </key>
<value> <value>
<none/> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -55,4 +59,22 @@ ...@@ -55,4 +59,22 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>roles</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>computer = state_change[\'object\']\n <value> <string>computer = state_change[\'object\']\n
computer.edit(allocation_scope=\'open/personal\')\n
portal = computer.getPortalObject()\n portal = computer.getPortalObject()\n
\n \n
internal_packing_list_url = context.portal_workflow.getInfoFor(\n internal_packing_list_url = context.portal_workflow.getInfoFor(\n
...@@ -62,6 +63,23 @@ internal_packing_list = portal.restrictedTraverse(internal_packing_list_url)\n ...@@ -62,6 +63,23 @@ internal_packing_list = portal.restrictedTraverse(internal_packing_list_url)\n
# portal.portal_workflow.doActionFor(internal_packing_list, \'deliver_action\')\n # portal.portal_workflow.doActionFor(internal_packing_list, \'deliver_action\')\n
internal_packing_list.deliver()\n internal_packing_list.deliver()\n
portal.portal_workflow.doActionFor(computer, \'validate_action\')\n portal.portal_workflow.doActionFor(computer, \'validate_action\')\n
\n
# Create a sale packing to restrict the computer usage by default to only its administrator\n
trade_condition_portal_type = "Sale Trade Condition"\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
sale_trade_condition_module = portal.getDefaultModule(trade_condition_portal_type)\n
sale_trade_condition = sale_trade_condition_module.newContent(\n
portal_type=trade_condition_portal_type,\n
destination_section_value=person,\n
source_section_value=person,\n
title="%s (%s) supply condition" % (computer.getTitle(), computer.getReference()),\n
)\n
sale_trade_condition.newContent(\n
portal_type="Sale Supply Line",\n
aggregate_value=computer,\n
resource=portal.portal_preferences.getPreferredInstanceSetupResource(),\n
)\n
sale_trade_condition.validate()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -154,14 +154,8 @@ if (request_software_instance is None):\n ...@@ -154,14 +154,8 @@ if (request_software_instance is None):\n
wf_id=\'person_slap_interface_workflow\')\n wf_id=\'person_slap_interface_workflow\')\n
open_order = portal.restrictedTraverse(open_order_url)\n open_order = portal.restrictedTraverse(open_order_url)\n
else:\n else:\n
open_order = portal.open_sale_order_module.newContent(\n raise ValueError(\'Person has no open order created\')\n
destination_section_uid=person.getUid(),\n \n
destination_decision_uid=person.getUid(),\n
title="ViFiB Open Order")\n
person.createOpenOrder(open_order_url=open_order.getRelativeUrl())\n
open_order.order()\n
open_order.validate()\n
\n
open_order.newContent(\n open_order.newContent(\n
portal_type="Open Sale Order Line",\n portal_type="Open Sale Order Line",\n
title=software_title,\n title=software_title,\n
......
...@@ -12,6 +12,16 @@ ...@@ -12,6 +12,16 @@
<tuple/> <tuple/>
</value> </value>
</item> </item>
<item>
<key> <string>creation_guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>groups</string> </key> <key> <string>groups</string> </key>
<value> <value>
...@@ -22,6 +32,14 @@ ...@@ -22,6 +32,14 @@
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>slap_interaction_workflow</string> </value> <value> <string>slap_interaction_workflow</string> </value>
</item> </item>
<item>
<key> <string>manager_bypass</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Slap Interaction Workflow</string> </value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <value>
<list> <list>
<string>SalePackingList_markComputerPartitionBusy</string> <string>Assignment_createPersonOpenSaleOrder</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -50,13 +50,13 @@ ...@@ -50,13 +50,13 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SalePackingList_confirm</string> </value> <value> <string>Assignment_open</string> </value>
</item> </item>
<item> <item>
<key> <string>method_id</string> </key> <key> <string>method_id</string> </key>
<value> <value>
<list> <list>
<string>confirm</string> <string>open</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<key> <string>portal_type_filter</string> </key> <key> <string>portal_type_filter</string> </key>
<value> <value>
<list> <list>
<string>Sale Packing List</string> <string>Assignment</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -78,6 +78,10 @@ ...@@ -78,6 +78,10 @@
<tuple/> <tuple/>
</value> </value>
</item> </item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<list>
<string>SalePackingList_reindexUnderDestructionComputerPartition</string>
</list>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SalePackingList_changeDestructionState</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>confirm</string>
<string>start</string>
<string>stop</string>
<string>deliver</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Sale Packing List</string>
</list>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>person = state_change[\'object\'].getParentValue()\n
portal = person.getPortalObject()\n
open_order = portal.portal_catalog.getResultValue(\n
default_destination_section_uid=person.getUid(),\n
portal_type="Open Sale Order",\t \t \n
validation_state="validated")\n
if open_order is None:\n
person_slap_interface_state = person.getSlapState()\n
if person_slap_interface_state != \'open_order_created\':\n
open_order = portal.open_sale_order_module.newContent(\n
destination_section=person.getRelativeUrl(),\n
destination_decision=person.getRelativeUrl(),\n
title="ViFiB Open Order")\n
person.createOpenOrder(open_order_url=open_order.getRelativeUrl())\n
open_order.order()\n
open_order.validate()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Assignment_createPersonOpenSaleOrder</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery, NegatedQuery\n
\n
current_delivery = state_change[\'object\']\n
portal = current_delivery.getPortalObject()\n
\n
destroy_service_relative_url = portal.portal_preferences.getPreferredInstanceCleanupResource()\n
\n
sale_packing_list_line_list = current_delivery.contentValues(portal_type="Sale Packing List Line")\n
for current_delivery_line in sale_packing_list_line_list:\n
if current_delivery_line.getResource() == destroy_service_relative_url:\n
\n
computer_partition = current_delivery_line.getAggregateValue(portal_type=["Computer Partition"])\n
computer_partition.activate(\n
after_path_and_method_id=(current_delivery.getPath(), (\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).reindexObject()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SalePackingList_reindexUnderDestructionComputerPartition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
427 439
\ No newline at end of file \ No newline at end of file
Assignment | slap_interaction_workflow
Computer Partition | computer_partition_slap_interface_workflow Computer Partition | computer_partition_slap_interface_workflow
Computer Partition | slap_interaction_workflow Computer Partition | slap_interaction_workflow
Computer | computer_slap_interface_workflow Computer | computer_slap_interface_workflow
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>computer = context\n
return computer.portal_catalog.getResultValue(\n
portal_type="Sale Supply Line",\n
aggregate_relative_url=computer.getRelativeUrl(),\n
validation_state="validated")\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Computer_getRelatedSaleSupplyLine</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
computer = context\n
\n
computer.edit(\n
allocation_scope=allocation_scope,\n
)\n
\n
sale_supply_line = computer.Computer_getRelatedSaleSupplyLine()\n
sale_trade_condition = sale_supply_line.getParentValue()\n
self_person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
self_email = self_person.getDefaultEmailCoordinateText()\n
if allocation_scope == \'open/public\':\n
# reset friends and update in place\n
sale_trade_condition.edit(\n
subject_list=[\'\'],\n
destination_section=None)\n
elif allocation_scope == \'open/personal\':\n
# reset friends to self and update in place\n
sale_trade_condition.edit(\n
subject_list=[self_email],\n
destination_section_value=self_person)\n
else:\n
if self_email not in subject_list:\n
# add self as friend\n
subject_list.append(self_email)\n
sale_trade_condition.edit(\n
subject_list=subject_list)\n
\n
message = context.Base_translateString("Allocation scope updated!")\n
return computer.Base_redirect(keep_items={\'portal_status_message\': message})\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>allocation_scope, subject_list, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Computer_updateAllocationScope</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Computer_updateAllocationScope</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>your_allocation_scope</string>
<string>your_subject_list</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Computer_viewAllocationScopeUpdateDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Computer_viewAllocationScopeUpdateDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Update the allocation scope</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_allocation_scope</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>The computer allocation scope</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_dialog_mode_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Allocation Scope</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getAllocationScope()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="LinesField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_subject_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>line_too_long</string> </key>
<value> <string>A line was too long.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>15</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Friends</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br />
]]></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>40</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.Computer_getRelatedSaleSupplyLine().getSubjectList()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
<list> <list>
<string>my_title</string> <string>my_title</string>
<string>my_reference</string> <string>my_reference</string>
<string>your_allocation_scope_update</string>
<string>listbox</string> <string>listbox</string>
</list> </list>
</value> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>css_class</string>
<string>default</string>
<string>href</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_allocation_scope_update</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>href</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string>nolabel validate alignr</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string>Update allocation scope</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_hyperlink</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewWebFieldLibrary</string> </value>
</item>
<item>
<key> <string>href</string> </key>
<value> <string>Computer_viewAllocationScopeUpdateDialog</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Update allocation scope</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
305 313
\ No newline at end of file \ No newline at end of file
...@@ -4,6 +4,7 @@ from zLOG import LOG, INFO ...@@ -4,6 +4,7 @@ from zLOG import LOG, INFO
from OFS.Traversable import NotFound from OFS.Traversable import NotFound
from lxml import etree from lxml import etree
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
parser = etree.XMLParser(remove_blank_text=True) parser = etree.XMLParser(remove_blank_text=True)
class ReportParser: class ReportParser:
...@@ -102,6 +103,10 @@ class VifibConduit: ...@@ -102,6 +103,10 @@ class VifibConduit:
def __init__(self): def __init__(self):
pass pass
@UnrestrictedMethod
def _applyTradeCondition(self, delivery_line):
delivery_line.SaleOrder_applySaleTradeCondition(batch_mode=1)
def addNode(self, object=None, xml=None, computer_id=None): def addNode(self, object=None, xml=None, computer_id=None):
""" """
Creates a Sale Packing List from a XML report sent by a node Creates a Sale Packing List from a XML report sent by a node
...@@ -170,8 +175,7 @@ class VifibConduit: ...@@ -170,8 +175,7 @@ class VifibConduit:
quantity = movement['quantity'], quantity = movement['quantity'],
aggregate_list = instance_setup_packing_list_line.getAggregateList()) aggregate_list = instance_setup_packing_list_line.getAggregateList())
usage_report_sale_packing_list_document_line.SaleOrder_applySaleTradeCondition( self._applyTradeCondition(usage_report_sale_packing_list_document_line)
batch_mode=1)
usage_report_sale_packing_list_document.confirm() usage_report_sale_packing_list_document.confirm()
usage_report_sale_packing_list_document.start() usage_report_sale_packing_list_document.start()
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl import Unauthorized from AccessControl import Unauthorized
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5Security.ERP5UserManager import SUPER_USER
from OFS.Traversable import NotFound from OFS.Traversable import NotFound
from Products.DCWorkflow.DCWorkflow import ValidationFailed from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
...@@ -138,18 +140,18 @@ class SlapTool(BaseTool): ...@@ -138,18 +140,18 @@ class SlapTool(BaseTool):
Reuses slap library for easy marshalling. Reuses slap library for easy marshalling.
""" """
computer_document = self._getComputerDocument(computer_id)
self.REQUEST.response.setHeader('Content-Type', 'text/xml') self.REQUEST.response.setHeader('Content-Type', 'text/xml')
slap_computer = Computer(computer_id) slap_computer = Computer(computer_id)
slap_computer._software_release_list = \ parent_uid = self._getComputerUidByReference(computer_id)
self._getSoftwareReleaseValueListForComputer(computer_document)
slap_computer._computer_partition_list = [] slap_computer._computer_partition_list = []
for computer_partition_document in computer_document.contentValues( slap_computer._software_release_list = \
self._getSoftwareReleaseValueListForComputer(computer_id)
for computer_partition in self.getPortalObject().portal_catalog(
parent_uid=parent_uid,
portal_type="Computer Partition"): portal_type="Computer Partition"):
slap_computer._computer_partition_list.append( slap_computer._computer_partition_list.append(
self._getSlapPartitionByPackingList(computer_partition_document)) self._getSlapPartitionByPackingList(computer_partition.getObject()))
return xml_marshaller.xml_marshaller.dumps(slap_computer) return xml_marshaller.xml_marshaller.dumps(slap_computer)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
...@@ -828,16 +830,20 @@ class SlapTool(BaseTool): ...@@ -828,16 +830,20 @@ class SlapTool(BaseTool):
validation_state="validated", validation_state="validated",
reference=computer_reference) reference=computer_reference)
@UnrestrictedMethod
def _getComputerUidByReference(self, computer_reference):
return self._getComputerDocument(computer_reference).getUid()
def _getComputerPartitionDocument(self, computer_reference, def _getComputerPartitionDocument(self, computer_reference,
computer_partition_reference): computer_partition_reference):
""" """
Get the computer partition defined in an available computer Get the computer partition defined in an available computer
""" """
# Related key might be nice # Related key might be nice
computer = self._getComputerDocument(computer_reference)
return self._getDocument(portal_type='Computer Partition', return self._getDocument(portal_type='Computer Partition',
reference=computer_partition_reference, reference=computer_partition_reference,
parent_uid=computer.getUid()) parent_uid=self._getComputerUidByReference(
computer_reference))
def _getUsageReportServiceDocument(self): def _getUsageReportServiceDocument(self):
service_document = self.Base_getUsageReportServiceDocument() service_document = self.Base_getUsageReportServiceDocument()
...@@ -871,6 +877,7 @@ class SlapTool(BaseTool): ...@@ -871,6 +877,7 @@ class SlapTool(BaseTool):
else: else:
return software_instance return software_instance
@UnrestrictedMethod
def _getSalePackingListLineAsSoftwareInstance(self, sale_packing_list_line): def _getSalePackingListLineAsSoftwareInstance(self, sale_packing_list_line):
merged_dict = sale_packing_list_line.\ merged_dict = sale_packing_list_line.\
SalePackinListLine_asSoftwareInstnaceComputerPartitionMergedDict() SalePackinListLine_asSoftwareInstnaceComputerPartitionMergedDict()
...@@ -880,8 +887,10 @@ class SlapTool(BaseTool): ...@@ -880,8 +887,10 @@ class SlapTool(BaseTool):
raise Unauthorized raise Unauthorized
return merged_dict return merged_dict
def _getSoftwareReleaseValueListForComputer(self, computer_document): @UnrestrictedMethod
def _getSoftwareReleaseValueListForComputer(self, computer_reference):
"""Returns list of Software Releases documentsfor computer""" """Returns list of Software Releases documentsfor computer"""
computer_document = self._getComputerDocument(computer_reference)
portal = self.getPortalObject() portal = self.getPortalObject()
state_list = [] state_list = []
...@@ -889,7 +898,6 @@ class SlapTool(BaseTool): ...@@ -889,7 +898,6 @@ class SlapTool(BaseTool):
state_list.extend(portal.getPortalTransitInventoryStateList()) state_list.extend(portal.getPortalTransitInventoryStateList())
software_release_list = [] software_release_list = []
computer_reference = computer_document.getReference()
for software_release_url_string in computer_document\ for software_release_url_string in computer_document\
.Computer_getSoftwareReleaseUrlStringList(state_list): .Computer_getSoftwareReleaseUrlStringList(state_list):
software_release_response = SoftwareRelease( software_release_response = SoftwareRelease(
......
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2011 Vifib SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from zLOG import LOG, PROBLEM, WARNING
from Products.ERP5Type.Globals import InitializeClass
from AccessControl import ClassSecurityInfo
import sys
from AccessControl.SecurityManagement import newSecurityManager,\
getSecurityManager, setSecurityManager
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.PluggableAuthService.PluggableAuthService import \
_SWALLOWABLE_PLUGIN_EXCEPTIONS
from Products.PluggableAuthService.interfaces import plugins
from Products.PluggableAuthService.utils import classImplements
from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
from Products.ERP5Type.Cache import transactional_cached
from Products.ERP5Security.ERP5UserManager import SUPER_USER
from ZODB.POSException import ConflictError
from Products.ERP5Security.ERP5GroupManager import ConsistencyError, NO_CACHE_MODE
from Products.ERP5Type.ERP5Type \
import ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
from Products.ERP5Type.Cache import CachingMethod
#Form for new plugin in ZMI
manage_addVifibShadowAuthenticationPluginForm = PageTemplateFile(
'www/Vifib_addVifibShadowAuthenticationPlugin', globals(),
__name__='manage_addVifibShadowAuthenticationPluginForm')
def addVifibShadowAuthenticationPlugin(dispatcher, id, title=None, REQUEST=None):
""" Add a VifibShadowAuthenticationPlugin to a Pluggable Auth Service. """
plugin = VifibShadowAuthenticationPlugin(id, title)
dispatcher._setObject(plugin.getId(), plugin)
if REQUEST is not None:
REQUEST['RESPONSE'].redirect(
'%s/manage_workspace'
'?manage_tabs_message='
'VifibShadowAuthenticationPlugin+added.'
% dispatcher.absolute_url())
@transactional_cached(lambda portal, *args: args)
def getUserByLogin(portal, login):
if isinstance(login, basestring):
login = login,
result = portal.portal_catalog.unrestrictedSearchResults(
portal_type=["Open Sale Order"],
validation_state="validated",
reference=dict(query=login, key='ExactMatch'),
select_expression='reference')
# XXX: Here, we filter catalog result list ALTHOUGH we did pass
# parameters to unrestrictedSearchResults to restrict result set.
# This is done because the following values can match person with
# reference "foo":
# "foo " because of MySQL (feature, PADSPACE collation):
# mysql> SELECT reference as r FROM catalog
# -> WHERE reference="foo ";
# +-----+
# | r |
# +-----+
# | foo |
# +-----+
# 1 row in set (0.01 sec)
# "bar OR foo" because of ZSQLCatalog tokenizing searched strings
# by default (feature).
return [x.getObject() for x in result if x['reference'] in login]
class VifibShadowAuthenticationPlugin(BasePlugin):
"""
Plugin to authenicate as shadows.
"""
meta_type = "Vifib Shadow Authentication Plugin"
security = ClassSecurityInfo()
def __init__(self, id, title=None):
#Register value
self._setId(id)
self.title = title
################################
# IAuthenticationPlugin #
################################
security.declarePrivate('authenticateCredentials')
def authenticateCredentials(self, credentials):
"""Authentificate with credentials"""
login = credentials.get('machine_login', None)
# Forbidden the usage of the super user.
if login == SUPER_USER:
return None
#Search the user by his login
user_list = self.getUserByLogin(login)
if len(user_list) != 1:
return None
return (login, login)
def getUserByLogin(self, login):
# Search the Catalog for login and return a list of person objects
# login can be a string or a list of strings
# (no docstring to prevent publishing)
if not login:
return []
if isinstance(login, list):
login = tuple(login)
elif not isinstance(login, tuple):
login = str(login)
try:
return getUserByLogin(self.getPortalObject(), login)
except ConflictError:
raise
except:
LOG('VifibShadowAuthenticationPlugin', PROBLEM, 'getUserByLogin failed',
error=sys.exc_info())
# Here we must raise an exception to prevent callers from caching
# a result of a degraded situation.
# The kind of exception does not matter as long as it's catched by
# PAS and causes a lookup using another plugin or user folder.
# As PAS does not define explicitely such exception, we must use
# the _SWALLOWABLE_PLUGIN_EXCEPTIONS list.
raise _SWALLOWABLE_PLUGIN_EXCEPTIONS[0]
#################################
# IGroupsPlugin #
#################################
# This is patched version of
# Products.ERP5Security.ERP5GroupManager.ERP5GroupManager.getGroupsForPrincipal
# which allows to treat Computer and Software Instance as loggable user
loggable_portal_type_list = ['Open Sale Order']
def getGroupsForPrincipal(self, principal, request=None):
""" See IGroupsPlugin.
"""
# If this is the super user, skip the check.
if principal.getId() == SUPER_USER:
return ()
def _getGroupsForPrincipal(user_name, path):
security_category_dict = {} # key is the base_category_list,
# value is the list of fetched categories
security_group_list = []
security_definition_list = ()
# because we aren't logged in, we have to create our own
# SecurityManager to be able to access the Catalog
sm = getSecurityManager()
if sm.getUser().getId() != SUPER_USER:
newSecurityManager(self, self.getUser(SUPER_USER))
try:
# To get the complete list of groups, we try to call the
# ERP5Type_getSecurityCategoryMapping which should return a list
# of lists of two elements (script, base_category_list) like :
# (
# ('script_1', ['base_category_1', 'base_category_2', ...]),
# ('script_2', ['base_category_1', 'base_category_3', ...])
# )
#
# else, if the script does not exist, falls back to a list containng
# only one list :
# (('ERP5Type_getSecurityCategoryFromAssignment',
# self.getPortalAssignmentBaseCategoryList() ),)
mapping_method = getattr(self,
'ERP5Type_getSecurityCategoryMapping', None)
if mapping_method is None:
security_definition_list = ((
'ERP5Type_getSecurityCategoryFromAssignment',
self.getPortalAssignmentBaseCategoryList()
),)
else:
security_definition_list = mapping_method()
# get the loggable document from its reference - no security check needed
catalog_result = self.portal_catalog.unrestrictedSearchResults(
portal_type=self.loggable_portal_type_list,
reference=user_name)
if len(catalog_result) != 1: # we won't proceed with groups
if len(catalog_result) > 1: # configuration is screwed
raise ConsistencyError, 'There is more than one of %s whose \
login is %s : %s' % (','.join(self.loggable_portal_type_list),
user_name,
repr([r.getObject() for r in catalog_result]))
else:
return ()
loggable_object = catalog_result[0].getObject()
finally:
setSecurityManager(sm)
return ('R-SHADOW', 'SHADOW-%s' % user_name)
if not NO_CACHE_MODE:
_getGroupsForPrincipal = CachingMethod(_getGroupsForPrincipal,
id='ERP5GroupManager_getGroupsForPrincipal',
cache_factory='erp5_content_short')
return _getGroupsForPrincipal(
user_name=principal.getId(),
path=self.getPhysicalPath())
#
# IUserEnumerationPlugin implementation
#
security.declarePrivate( 'enumerateUsers' )
def enumerateUsers(self, id=None, login=None, exact_match=False,
sort_by=None, max_results=None, **kw):
""" See IUserEnumerationPlugin.
"""
if id is None:
id = login
if isinstance(id, str):
id = (id,)
if isinstance(id, list):
id = tuple(id)
user_info = []
plugin_id = self.getId()
id_list = []
for user_id in id:
if SUPER_USER == user_id:
info = { 'id' : SUPER_USER
, 'login' : SUPER_USER
, 'pluginid' : plugin_id
}
user_info.append(info)
else:
id_list.append(user_id)
if id_list:
for user in self.getUserByLogin(tuple(id_list)):
info = { 'id' : user.getReference()
, 'login' : user.getReference()
, 'pluginid' : plugin_id
}
user_info.append(info)
return tuple(user_info)
#List implementation of class
classImplements(VifibShadowAuthenticationPlugin,
plugins.IAuthenticationPlugin)
classImplements( VifibShadowAuthenticationPlugin,
plugins.IGroupsPlugin
)
classImplements( VifibShadowAuthenticationPlugin,
plugins.IUserEnumerationPlugin
)
InitializeClass(VifibShadowAuthenticationPlugin)
...@@ -42,6 +42,7 @@ portal_tools = ( SlapTool.SlapTool, CertificateAuthorityTool.CertificateAuthorit ...@@ -42,6 +42,7 @@ portal_tools = ( SlapTool.SlapTool, CertificateAuthorityTool.CertificateAuthorit
from Products.PluggableAuthService.PluggableAuthService import registerMultiPlugin from Products.PluggableAuthService.PluggableAuthService import registerMultiPlugin
import VifibMachineAuthenticationPlugin import VifibMachineAuthenticationPlugin
import VifibShadowAuthenticationPlugin
def initialize(context): def initialize(context):
import Document import Document
...@@ -59,5 +60,15 @@ def initialize(context): ...@@ -59,5 +60,15 @@ def initialize(context):
, icon='www/portal.gif' , icon='www/portal.gif'
) )
context.registerClass( VifibShadowAuthenticationPlugin.VifibShadowAuthenticationPlugin
, permission=ManageUsers
, constructors=(
VifibShadowAuthenticationPlugin.manage_addVifibShadowAuthenticationPluginForm,
VifibShadowAuthenticationPlugin.addVifibShadowAuthenticationPlugin, )
, visibility=None
, icon='www/portal.gif'
)
registerMultiPlugin(VifibMachineAuthenticationPlugin.VifibMachineAuthenticationPlugin.meta_type) registerMultiPlugin(VifibMachineAuthenticationPlugin.VifibMachineAuthenticationPlugin.meta_type)
registerMultiPlugin(VifibShadowAuthenticationPlugin.VifibShadowAuthenticationPlugin.meta_type)
...@@ -275,6 +275,22 @@ class testVifibMixin(ERP5TypeTestCase): ...@@ -275,6 +275,22 @@ class testVifibMixin(ERP5TypeTestCase):
vifib_auth.manage_activateInterfaces(('IAuthenticationPlugin', vifib_auth.manage_activateInterfaces(('IAuthenticationPlugin',
'IExtractionPlugin', 'IGroupsPlugin', 'IUserEnumerationPlugin')) 'IExtractionPlugin', 'IGroupsPlugin', 'IUserEnumerationPlugin'))
def setupVifibShadowAuthenticationPlugin(self):
"""Sets up Vifib Authentication plugin"""
pas = self.getPortal().acl_users
vifib_auth_list = [q for q in pas.objectValues() \
if q.meta_type == 'Vifib Shadow Authentication Plugin']
if len(vifib_auth_list) == 0:
vifib_dispacher = pas.manage_addProduct['Vifib']
vifib_dispacher.addVifibShadowAuthenticationPlugin('vifib_auth_shadow')
vifib_auth = pas.vifib_auth_shadow
else:
if len(vifib_auth_list) > 1:
raise ValueError('More then one Vifib Shadow authentication')
vifib_auth = vifib_auth_list[0]
vifib_auth.manage_activateInterfaces(('IAuthenticationPlugin',
'IGroupsPlugin', 'IUserEnumerationPlugin'))
def bootstrapSite(self): def bootstrapSite(self):
""" """
Manager has to create an administrator user first. Manager has to create an administrator user first.
...@@ -301,6 +317,7 @@ class testVifibMixin(ERP5TypeTestCase): ...@@ -301,6 +317,7 @@ class testVifibMixin(ERP5TypeTestCase):
self.logMessage("Bootstrap Vifib Without Security...") self.logMessage("Bootstrap Vifib Without Security...")
self.login() self.login()
self.setupVifibMachineAuthenticationPlugin() self.setupVifibMachineAuthenticationPlugin()
self.setupVifibShadowAuthenticationPlugin()
self.setPreference() self.setPreference()
self.setSystemPreference() self.setSystemPreference()
self.setupRuleTool() self.setupRuleTool()
...@@ -335,6 +352,9 @@ class testVifibMixin(ERP5TypeTestCase): ...@@ -335,6 +352,9 @@ class testVifibMixin(ERP5TypeTestCase):
def stepLoginTestVifibCustomer(self, **kw): def stepLoginTestVifibCustomer(self, **kw):
self.login('test_vifib_customer') self.login('test_vifib_customer')
def stepLoginTestVifibCustomerA(self, **kw):
self.login('test_vifib_customer_a')
def stepLoginTestVifibDeveloper(self, **kw): def stepLoginTestVifibDeveloper(self, **kw):
self.login('test_vifib_developer') self.login('test_vifib_developer')
......
from Products.ERP5Type.tests.Sequence import SequenceList
import unittest
from testVifibSlapWebService import TestVifibSlapWebServiceMixin
class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
def stepCheckComputerAllocationScopeEmpty(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
self.assertEqual(computer.getAllocationScope(), None)
def stepCheckComputerAllocationScopeOpenFriend(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
self.assertEqual(computer.getAllocationScope(), 'open/friend')
def stepCheckComputerAllocationScopeClose(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
self.assertEqual(computer.getAllocationScope(), 'close')
def stepCheckComputerAllocationScopeOpenPersonal(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
self.assertEqual(computer.getAllocationScope(), 'open/personal')
def stepCheckComputerAllocationScopeOpenPublic(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
self.assertEqual(computer.getAllocationScope(), 'open/public')
def stepCheckComputerTradeConditionDestinationSectionTestVifibCustomer(
self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
trade_condition = computer.getAggregateRelatedValue(
portal_type='Sale Supply Line').getParentValue()
person_url = self.portal.portal_catalog.getResultValue(portal_type='Person',
default_email_text='test_customer@example.org').getRelativeUrl()
self.assertEqual(trade_condition.getDestinationSectionList(), [person_url])
def stepCheckComputerTradeConditionDestinationSectionVifibAdminTestVifibCustomer(
self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
trade_condition = computer.getAggregateRelatedValue(
portal_type='Sale Supply Line').getParentValue()
person_url_list = sorted([q.getRelativeUrl() for q in \
self.portal.portal_catalog(portal_type='Person',
default_email_text=['test_customer@example.org',
'test_computer_vifib_admin@example.org'])])
self.assertEqual(sorted(trade_condition.getDestinationSectionList()),
person_url_list)
request_and_install_software = """
LoginTestVifibCustomer
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
"""
def stepCheckNoRelatedSalePackingListLineForSoftwareInstance(self, sequence,
**kw):
software_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
self.assertEqual(0, len(software_instance.getAggregateRelatedValueList(
portal_type=self.sale_packing_list_line_portal_type)))
def stepSetSequenceSlaXmlCurrentComputer(self, sequence, **kw):
sequence['sla_xml'] = """<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id="computer_guid">%s</parameter>
</instance>""" % sequence['computer_reference']
sequence['requested_filter_dict'] = dict(
computer_guid=sequence['computer_reference'])
def test_allocation_scope_open_personal(self):
"""Check that computer is open/personal it is only available
to owner"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = """
LoginTestVifibCustomer
CustomerRegisterNewComputer
Tic
Logout
LoginDefaultUser
SetComputerCoordinatesFromComputerTitle
Logout
SetSequenceSlaXmlCurrentComputer
SlapLoginCurrentComputer
FormatComputer
Tic
SlapLogout
LoginDefaultUser
CheckComputerAllocationScopeOpenPersonal
CheckComputerTradeConditionDestinationSectionTestVifibCustomer
Logout
""" + self.prepare_published_software_release + \
self.request_and_install_software + """
# request as owner
LoginTestVifibCustomer
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for owner
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
# request as someone else
LoginTestVifibAdmin
PersonRequestSoftwareInstance
Tic
Logout
# fail to instantiate for someone else
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
# request as owner
LoginTestVifibCustomer
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for owner
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepComputerSetAllocationScopeOpenFriendTestVifibAdmin(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
request = self.app.REQUEST
self.getPortal().portal_skins.changeSkin("Hosting")
request.set('portal_skin', "Hosting")
computer.Computer_updateAllocationScope(allocation_scope='open/friend',
subject_list=['test_computer_vifib_admin@example.org'])
self.getPortal().portal_skins.changeSkin("View")
request.set('portal_skin', "View")
def test_allocation_scope_open_friend(self):
"""Check that computer is open/friend it is only available
to owner and its friends"""
self.computer_partition_amount = 3
sequence_list = SequenceList()
sequence_string = """
LoginTestVifibCustomer
CustomerRegisterNewComputer
Tic
Logout
LoginDefaultUser
SetComputerCoordinatesFromComputerTitle
Logout
LoginTestVifibCustomer
ComputerSetAllocationScopeOpenFriendTestVifibAdmin
Tic
Logout
SetSequenceSlaXmlCurrentComputer
SlapLoginCurrentComputer
FormatComputer
Tic
SlapLogout
LoginDefaultUser
CheckComputerAllocationScopeOpenFriend
CheckComputerTradeConditionDestinationSectionVifibAdminTestVifibCustomer
Logout
""" + self.prepare_published_software_release + \
self.request_and_install_software + """
# request as owner
LoginTestVifibCustomer
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for owner
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
# request as friend
LoginTestVifibAdmin
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for friend
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
# request as someone else
LoginTestVifibCustomerA
PersonRequestSoftwareInstance
Tic
Logout
# fail to instantiate for someone else
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
# request as friend
LoginTestVifibAdmin
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for friend
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_allocation_scope_open_public(self):
"""Check that computer is open/public it is only available
to anybody"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = """
LoginTestVifibCustomer
CustomerRegisterNewComputer
Tic
Logout
LoginDefaultUser
SetComputerCoordinatesFromComputerTitle
Logout
LoginTestVifibCustomer
ComputerSetAllocationScopeOpenPublic
Tic
Logout
SetSequenceSlaXmlCurrentComputer
SlapLoginCurrentComputer
FormatComputer
Tic
SlapLogout
LoginDefaultUser
CheckComputerAllocationScopeOpenPublic
CheckComputerTradeConditionDestinationSectionListEmpty
Logout
""" + self.prepare_published_software_release + \
self.request_and_install_software + """
# request as owner
LoginTestVifibCustomer
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for owner
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
# request as someone else
LoginTestVifibAdmin
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for someone else
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_allocation_scope_close(self):
"""Check that computer is close it is not only available
to anybody"""
sequence_list = SequenceList()
sequence_string = """
LoginTestVifibCustomer
CustomerRegisterNewComputer
Tic
Logout
LoginDefaultUser
SetComputerCoordinatesFromComputerTitle
Logout
LoginTestVifibCustomer
ComputerSetAllocationScopeClose
Tic
Logout
SetSequenceSlaXmlCurrentComputer
SlapLoginCurrentComputer
FormatComputer
Tic
SlapLogout
LoginDefaultUser
CheckComputerAllocationScopeClose
CheckComputerTradeConditionDestinationSectionTestVifibCustomer
Logout
""" + self.prepare_published_software_release + \
self.request_and_install_software + """
# request as owner
LoginTestVifibCustomer
PersonRequestSoftwareInstance
Tic
Logout
# fail to instantiate for owner
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_allocation_scope_empty(self):
"""Check that computer's allocation scope is not set it is unavailable"""
sequence_list = SequenceList()
sequence_string = """
LoginTestVifibCustomer
CustomerRegisterNewComputer
Tic
Logout
LoginDefaultUser
SetComputerCoordinatesFromComputerTitle
Logout
LoginTestVifibCustomer
ComputerSetAllocationScopeEmpty
Tic
Logout
SetSequenceSlaXmlCurrentComputer
SlapLoginCurrentComputer
FormatComputer
Tic
SlapLogout
LoginDefaultUser
CheckComputerAllocationScopeEmpty
CheckComputerTradeConditionDestinationSectionTestVifibCustomer
Logout
""" + self.prepare_published_software_release + \
self.request_and_install_software + """
# request as owner
LoginTestVifibCustomer
PersonRequestSoftwareInstance
Tic
Logout
# fail to instantiate for owner
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckNoRelatedSalePackingListLineForSoftwareInstance
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
prepare_open_public_computer = """
LoginTestVifibCustomer
CustomerRegisterNewComputer
Tic
Logout
LoginDefaultUser
SetComputerCoordinatesFromComputerTitle
Logout
LoginTestVifibCustomer
ComputerSetAllocationScopeOpenPublic
Tic
Logout
SetSequenceSlaXmlCurrentComputer
SlapLoginCurrentComputer
FormatComputer
Tic
SlapLogout
LoginDefaultUser
CheckComputerAllocationScopeOpenPublic
CheckComputerTradeConditionDestinationSectionListEmpty
Logout
""" + TestVifibSlapWebServiceMixin.prepare_published_software_release \
+ request_and_install_software
def test_allocation_scope_public_software_instance_request(self):
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_open_public_computer + """
# request as someone else
LoginTestVifibAdmin
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for someone else
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
# now this computer patrition request new one
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
Tic
SlapLogout
LoginDefaultUser
CheckSoftwareInstanceAndRelatedComputerPartition
CheckRequestedSoftwareInstanceAndRelatedComputerPartition
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Tic
CheckRequestedComputerPartitionCleanParameterList
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_allocation_scope_personal_software_instance_request(self):
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_open_public_computer + """
# request as someone else
LoginTestVifibAdmin
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for someone else
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
# change allocation to personal
LoginTestVifibCustomer
ComputerSetAllocationScopeOpenPersonal
Tic
Logout
LoginDefaultUser
CheckComputerAllocationScopeOpenPersonal
CheckComputerTradeConditionDestinationSectionTestVifibCustomer
Logout
# now this computer patrition request new one
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepStoreTestVifibAdminComputerPartitionCoordinate(self, sequence, **kw):
sequence.edit(
test_vifib_admin_computer_reference=sequence['computer_reference'],
test_vifib_admin_computer_partition_reference=sequence[
'computer_partition_reference'],
test_vifib_admin_software_instance_reference=sequence[
'software_instance_reference'],
test_vifib_admin_software_instance_uid=sequence[
'software_instance_uid'],
)
def stepRestoreTestVifibAdminComputerPartitionCoordinate(self,
sequence, **kw):
sequence.edit(
computer_reference=sequence['test_vifib_admin_computer_reference'],
computer_partition_reference=sequence[
'test_vifib_admin_computer_partition_reference'],
software_instance_reference=sequence[
'test_vifib_admin_software_instance_reference'],
software_instance_uid=sequence[
'test_vifib_admin_software_instance_uid'],
)
def test_allocation_scope_friend_software_instance_request(self):
self.computer_partition_amount = 3
sequence_list = SequenceList()
sequence_string = self.prepare_open_public_computer + """
# request as friend
LoginTestVifibAdmin
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for friend
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
StoreTestVifibAdminComputerPartitionCoordinate
# request as someone else
LoginTestVifibCustomerA
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for someone else
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
# change allocation to friend
LoginTestVifibCustomer
ComputerSetAllocationScopeOpenFriendTestVifibAdmin
Tic
Logout
LoginDefaultUser
CheckComputerAllocationScopeOpenFriend
CheckComputerTradeConditionDestinationSectionVifibAdminTestVifibCustomer
Logout
# now this computer patrition request new one
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse
SlapLogout
# now vifib_admin computer partition request new one and suceeds
RestoreTestVifibAdminComputerPartitionCoordinate
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
Tic
SlapLogout
LoginDefaultUser
CheckSoftwareInstanceAndRelatedComputerPartition
CheckRequestedSoftwareInstanceAndRelatedComputerPartition
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Tic
CheckRequestedComputerPartitionCleanParameterList
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_allocation_scope_close_software_instance_request(self):
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_open_public_computer + """
# request as someone else
LoginTestVifibAdmin
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for someone else
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
# change allocation to close
LoginTestVifibCustomer
ComputerSetAllocationScopeClose
Tic
Logout
LoginDefaultUser
CheckComputerAllocationScopeClose
CheckComputerTradeConditionDestinationSectionTestVifibCustomer
Logout
# now this computer patrition request new one
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_allocation_scope_empty_software_instance_request(self):
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_open_public_computer + """
# request as someone else
LoginTestVifibAdmin
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for someone else
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
# change allocation to empty
LoginTestVifibCustomer
ComputerSetAllocationScopeEmpty
Tic
Logout
LoginDefaultUser
CheckComputerAllocationScopeEmpty
CheckComputerTradeConditionDestinationSectionTestVifibCustomer
Logout
# now this computer patrition request new one
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepSetSequenceSoftwareInstanceStateStopped(self, sequence, **kw):
sequence['software_instance_state'] = 'stopped'
def test_start_computer_partition_allocation_scope_close(self):
"""Check that it is possible to request stop of computer partition even
if computer is close"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = """
LoginTestVifibCustomer
CustomerRegisterNewComputer
Tic
Logout
LoginDefaultUser
SetComputerCoordinatesFromComputerTitle
Logout
LoginTestVifibCustomer
ComputerSetAllocationScopeOpenPublic
Tic
Logout
SetSequenceSlaXmlCurrentComputer
SetSequenceSoftwareInstanceStateStopped
SlapLoginCurrentComputer
FormatComputer
Tic
SlapLogout
LoginDefaultUser
CheckComputerAllocationScopeOpenPublic
CheckComputerTradeConditionDestinationSectionListEmpty
Logout
""" + self.prepare_published_software_release + \
self.request_and_install_software + """
# request as owner
LoginTestVifibCustomer
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for owner
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
# request as someone else
LoginTestVifibAdmin
PersonRequestSoftwareInstance
Tic
Logout
# instantiate for someone else
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
# confirm instantiation
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
SlapLogout
LoginDefaultUser
SetSelectedComputerPartition
CheckComputerPartitionInstanceSetupSalePackingListStopped
CheckComputerPartitionNoInstanceHostingSalePackingList
Logout
# close allocation scope of computer
LoginTestVifibCustomer
ComputerSetAllocationScopeClose
Tic
Logout
LoginDefaultUser
CheckComputerAllocationScopeClose
CheckComputerTradeConditionDestinationSectionTestVifibCustomer
Logout
# request start and check that it worked
LoginTestVifibAdmin
RequestSoftwareInstanceStart
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListConfirmed
Logout
SlapLoginCurrentComputer
SoftwareInstanceStarted
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListStarted
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapAllocationScope))
return suite
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
import unittest import unittest
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from slapos import slap from slapos import slap
from testVifibSlapWebService import TestVifibSlapWebServiceMixin from testVifibSlapWebService import TestVifibSlapWebServiceMixin
from random import random from random import random
...@@ -59,7 +60,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -59,7 +60,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
def stepBang(self, sequence, **kw): def stepBang(self, sequence, **kw):
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
slap_computer_partition = self.slap.registerComputerPartition( slap_computer_partition = self.slap.registerComputerPartition(
sequence['computer_reference'], sequence['computer_reference'],
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
...@@ -209,7 +210,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -209,7 +210,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
def stepComputerBang(self, sequence, **kw): def stepComputerBang(self, sequence, **kw):
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
slap_computer = self.slap.registerComputer( slap_computer = self.slap.registerComputer(
sequence['computer_reference']) sequence['computer_reference'])
slap_computer.bang(self.bang_message) slap_computer.bang(self.bang_message)
...@@ -265,6 +266,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -265,6 +266,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
# Computer owner cannot do bang yet
@expectedFailure
def test_admin_bang_computer_complex_tree(self): def test_admin_bang_computer_complex_tree(self):
"""Checks that bangs works on complex tree """Checks that bangs works on complex tree
......
...@@ -219,7 +219,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -219,7 +219,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
# Create first computer # Create first computer
LoginTestVifibAdmin LoginTestVifibAdmin
CreateComputer CustomerRegisterNewComputer
Tic
SetComputerCoordinatesFromComputerTitle
ComputerSetAllocationScopeOpenPublic
Tic Tic
Logout Logout
SlapLoginCurrentComputer SlapLoginCurrentComputer
...@@ -313,7 +316,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -313,7 +316,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
# Now prepare second computer # Now prepare second computer
LoginTestVifibAdmin LoginTestVifibAdmin
CreateComputer CustomerRegisterNewComputer
Tic
SetComputerCoordinatesFromComputerTitle
ComputerSetAllocationScopeOpenPublic
Tic Tic
Logout Logout
SlapLoginCurrentComputer SlapLoginCurrentComputer
...@@ -571,7 +577,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -571,7 +577,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
# Create first computer # Create first computer
LoginTestVifibAdmin LoginTestVifibAdmin
CreateComputer CustomerRegisterNewComputer
Tic
SetComputerCoordinatesFromComputerTitle
ComputerSetAllocationScopeOpenPublic
Tic Tic
Logout Logout
SlapLoginCurrentComputer SlapLoginCurrentComputer
...@@ -682,7 +691,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -682,7 +691,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
# Create the computer # Create the computer
LoginTestVifibAdmin LoginTestVifibAdmin
CreateComputer CustomerRegisterNewComputer
Tic
SetComputerCoordinatesFromComputerTitle
ComputerSetAllocationScopeOpenPublic
Tic Tic
Logout Logout
SlapLoginCurrentComputer SlapLoginCurrentComputer
...@@ -830,7 +842,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -830,7 +842,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
# Create the computer # Create the computer
LoginTestVifibAdmin LoginTestVifibAdmin
CreateComputer CustomerRegisterNewComputer
Tic
SetComputerCoordinatesFromComputerTitle
ComputerSetAllocationScopeOpenPublic
Tic Tic
Logout Logout
SlapLoginCurrentComputer SlapLoginCurrentComputer
...@@ -987,7 +1002,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -987,7 +1002,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
# Create the computer # Create the computer
LoginTestVifibAdmin LoginTestVifibAdmin
CreateComputer CustomerRegisterNewComputer
Tic
SetComputerCoordinatesFromComputerTitle
ComputerSetAllocationScopeOpenPublic
Tic Tic
Logout Logout
SlapLoginCurrentComputer SlapLoginCurrentComputer
......
...@@ -318,6 +318,8 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin ...@@ -318,6 +318,8 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin
LoginDefaultUser \ LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \ ConfirmOrderedSaleOrderActiveSense \
Tic \ Tic \
SetDeliveryLineAmountEqualOne \
CheckComputerPartitionInstanceSetupSalePackingListConfirmed \
Logout \ Logout \
\ \
SlapLoginCurrentComputer \ SlapLoginCurrentComputer \
......
...@@ -27,7 +27,10 @@ class TestVifibSlapComputerPartitionConnection(TestVifibSlapWebServiceMixin): ...@@ -27,7 +27,10 @@ class TestVifibSlapComputerPartitionConnection(TestVifibSlapWebServiceMixin):
Logout Logout
LoginTestVifibAdmin LoginTestVifibAdmin
CreateComputer CustomerRegisterNewComputer
Tic
SetComputerCoordinatesFromComputerTitle
ComputerSetAllocationScopeOpenPublic
Tic Tic
Logout Logout
......
...@@ -15,7 +15,10 @@ class TestVifibSlapComputerPartitionError(TestVifibSlapWebServiceMixin): ...@@ -15,7 +15,10 @@ class TestVifibSlapComputerPartitionError(TestVifibSlapWebServiceMixin):
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
LoginTestVifibAdmin \ LoginTestVifibAdmin \
CreateComputer \ CustomerRegisterNewComputer \
Tic \
SetComputerCoordinatesFromComputerTitle \
ComputerSetAllocationScopeOpenPublic \
Tic \ Tic \
Logout \ Logout \
SlapLoginCurrentComputer \ SlapLoginCurrentComputer \
......
...@@ -26,10 +26,6 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): ...@@ -26,10 +26,6 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
# XXX: This test fails because test_vifib_customer security is cached
# and this user is not in SOFTINST-x group. We do not want to clear
# cache in tests.
@expectedFailure
def test_ComputerPartition_request_noParameterInRequest(self): def test_ComputerPartition_request_noParameterInRequest(self):
""" """
Check that it is possible to request another Computer Partition Check that it is possible to request another Computer Partition
...@@ -42,6 +38,8 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): ...@@ -42,6 +38,8 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance \ SlapLoginCurrentSoftwareInstance \
RequestComputerPartition \ RequestComputerPartition \
Tic \ Tic \
CheckRaisesNotFoundComputerPartitionParameterDict \
Tic \
SlapLogout \ SlapLogout \
\ \
LoginDefaultUser \ LoginDefaultUser \
...@@ -50,6 +48,8 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): ...@@ -50,6 +48,8 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
Logout \ Logout \
\ \
SlapLoginCurrentSoftwareInstance \ SlapLoginCurrentSoftwareInstance \
RequestComputerPartition \
Tic \
CheckRequestedComputerPartitionCleanParameterList \ CheckRequestedComputerPartitionCleanParameterList \
SlapLogout \ SlapLogout \
\ \
...@@ -89,7 +89,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): ...@@ -89,7 +89,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
RequestComputerPartition \ RequestComputerPartition \
Tic \ Tic \
CheckRequestedComputerPartitionCleanParameterList \ CheckRequestedComputerPartitionCleanParameterList \
Logout \ SlapLogout \
\ \
LoginDefaultUser \ LoginDefaultUser \
SetCurrentSoftwareInstanceRequested \ SetCurrentSoftwareInstanceRequested \
...@@ -156,7 +156,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): ...@@ -156,7 +156,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
RequestComputerPartition \ RequestComputerPartition \
Tic \ Tic \
CheckRequestedComputerPartitionCleanParameterList \ CheckRequestedComputerPartitionCleanParameterList \
Logout \ SlapLogout \
\ \
LoginDefaultUser \ LoginDefaultUser \
SetCurrentSoftwareInstanceRequested \ SetCurrentSoftwareInstanceRequested \
...@@ -219,7 +219,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): ...@@ -219,7 +219,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
RequestComputerPartition \ RequestComputerPartition \
Tic \ Tic \
CheckRequestedComputerPartitionCleanParameterList \ CheckRequestedComputerPartitionCleanParameterList \
Logout \ SlapLogout \
\ \
LoginDefaultUser \ LoginDefaultUser \
SetCurrentSoftwareInstanceRequested \ SetCurrentSoftwareInstanceRequested \
...@@ -293,8 +293,10 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): ...@@ -293,8 +293,10 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
request_dict = { 'computer_id': sequence['computer_reference'] , request_dict = { 'computer_id': sequence['computer_reference'] ,
'computer_partition_id': sequence['computer_partition_reference'], 'computer_partition_id': sequence['computer_partition_reference'],
'software_release': sequence['software_release_uri'], 'software_release': sequence['software_release_uri'],
'software_type': sequence.get('requested_reference', 'requested_reference'), 'software_type': sequence.get('requested_software_type',
'partition_reference': sequence.get('requested_reference', 'requested_reference'), 'requested_software_type'),
'partition_reference': sequence.get('requested_reference',
'requested_reference'),
'shared_xml': xml_marshaller.dumps(kw.get("shared", False)), 'shared_xml': xml_marshaller.dumps(kw.get("shared", False)),
'partition_parameter_xml': xml_marshaller.dumps({}), 'partition_parameter_xml': xml_marshaller.dumps({}),
'filter_xml': xml_marshaller.dumps({}), 'filter_xml': xml_marshaller.dumps({}),
...@@ -1062,7 +1064,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): ...@@ -1062,7 +1064,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
def stepRequestComputerPartitionWithAnotherSoftwareType(self, sequence, **kw): def stepRequestComputerPartitionWithAnotherSoftwareType(self, sequence, **kw):
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
slap_computer_partition = self.slap.registerComputerPartition( slap_computer_partition = self.slap.registerComputerPartition(
sequence['computer_reference'], sequence['computer_reference'],
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
...@@ -1079,7 +1081,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): ...@@ -1079,7 +1081,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
def stepCheckRequestComputerPartitionWithAnotherSoftwareType( def stepCheckRequestComputerPartitionWithAnotherSoftwareType(
self, sequence, **kw): self, sequence, **kw):
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
slap_computer_partition = self.slap.registerComputerPartition( slap_computer_partition = self.slap.registerComputerPartition(
sequence['computer_reference'], sequence['computer_reference'],
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
......
...@@ -505,7 +505,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): ...@@ -505,7 +505,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin):
def stepRequestComputerPartitionNoTic(self, sequence, **kw): def stepRequestComputerPartitionNoTic(self, sequence, **kw):
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
slap_computer_partition = self.slap.registerComputerPartition( slap_computer_partition = self.slap.registerComputerPartition(
sequence['computer_reference'], sequence['computer_reference'],
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
......
...@@ -13,7 +13,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin): ...@@ -13,7 +13,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
**kw): **kw):
software_release = sequence['software_release_uri'] software_release = sequence['software_release_uri']
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
open_order = self.slap.registerOpenOrder() open_order = self.slap.registerOpenOrder()
open_order.request( open_order.request(
software_release=software_release, software_release=software_release,
...@@ -27,7 +27,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin): ...@@ -27,7 +27,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
def stepPersonRequestSlapSoftwareInstance(self, sequence, **kw): def stepPersonRequestSlapSoftwareInstance(self, sequence, **kw):
software_release = sequence['software_release_uri'] software_release = sequence['software_release_uri']
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
open_order = self.slap.registerOpenOrder() open_order = self.slap.registerOpenOrder()
requested_slap_computer_partition = open_order.request( requested_slap_computer_partition = open_order.request(
software_release=software_release, software_release=software_release,
...@@ -194,7 +194,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin): ...@@ -194,7 +194,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
self, sequence, **kw): self, sequence, **kw):
software_release = sequence['software_release_uri'] software_release = sequence['software_release_uri']
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
open_order = self.slap.registerOpenOrder() open_order = self.slap.registerOpenOrder()
requested_slap_computer_partition = open_order.request( requested_slap_computer_partition = open_order.request(
software_release=software_release, software_release=software_release,
...@@ -207,7 +207,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin): ...@@ -207,7 +207,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
self, sequence, **kw): self, sequence, **kw):
software_release = sequence['software_release_uri'] software_release = sequence['software_release_uri']
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
open_order = self.slap.registerOpenOrder() open_order = self.slap.registerOpenOrder()
requested_slap_computer_partition = open_order.request( requested_slap_computer_partition = open_order.request(
software_release=software_release, software_release=software_release,
......
...@@ -55,7 +55,10 @@ class TestVifibSlapRegisterComputer(TestVifibSlapWebServiceMixin): ...@@ -55,7 +55,10 @@ class TestVifibSlapRegisterComputer(TestVifibSlapWebServiceMixin):
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
LoginTestVifibAdmin \ LoginTestVifibAdmin \
CreateComputer \ CustomerRegisterNewComputer \
Tic \
SetComputerCoordinatesFromComputerTitle \
ComputerSetAllocationScopeOpenPublic \
Tic \ Tic \
Logout \ Logout \
\ \
...@@ -73,12 +76,18 @@ class TestVifibSlapRegisterComputer(TestVifibSlapWebServiceMixin): ...@@ -73,12 +76,18 @@ class TestVifibSlapRegisterComputer(TestVifibSlapWebServiceMixin):
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
LoginTestVifibAdmin \ LoginTestVifibAdmin \
CreateComputer \ CustomerRegisterNewComputer \
Tic \
SetComputerCoordinatesFromComputerTitle \
ComputerSetAllocationScopeOpenPublic \
Tic \ Tic \
Logout \ Logout \
\ \
LoginTestVifibAdmin \ LoginTestVifibAdmin \
CreateComputer \ CustomerRegisterNewComputer \
Tic \
SetComputerCoordinatesFromComputerTitle \
ComputerSetAllocationScopeOpenPublic \
Tic \ Tic \
Logout \ Logout \
\ \
......
...@@ -15,7 +15,10 @@ class TestVifibSlapRegisterSoftwareRelease(TestVifibSlapWebServiceMixin): ...@@ -15,7 +15,10 @@ class TestVifibSlapRegisterSoftwareRelease(TestVifibSlapWebServiceMixin):
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = self.prepare_computer + '\ sequence_string = self.prepare_computer + '\
LoginTestVifibAdmin \ LoginTestVifibAdmin \
CreateComputer \ CustomerRegisterNewComputer \
Tic \
SetComputerCoordinatesFromComputerTitle \
ComputerSetAllocationScopeOpenPublic \
Tic \ Tic \
Logout \ Logout \
\ \
......
...@@ -206,10 +206,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -206,10 +206,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
sequence): sequence):
computer_partition = self.portal.portal_catalog.getResultValue( computer_partition = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_partition_uid']) uid=sequence['computer_partition_uid'])
delivery_line_list = [q for q in computer_partition delivery_line_list = [q.getObject() for q in self.portal.portal_catalog(
.getAggregateRelatedValueList( aggregate_relative_url=computer_partition.getRelativeUrl(),
portal_type=self.sale_packing_list_line_portal_type) portal_type=self.sale_packing_list_line_portal_type,
if q.getResource() == resource] resource_relative_url=resource)]
self.assertEqual(0, len(delivery_line_list)) self.assertEqual(0, len(delivery_line_list))
def _checkComputerPartitionSalePackingListState(self, state, def _checkComputerPartitionSalePackingListState(self, state,
...@@ -217,22 +217,27 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -217,22 +217,27 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
delivery_line_amount = sequence.get("delivery_line_amount", 1) delivery_line_amount = sequence.get("delivery_line_amount", 1)
computer_partition = self.portal.portal_catalog.getResultValue( computer_partition = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_partition_uid']) uid=sequence['computer_partition_uid'])
delivery_line_list = [q for q in computer_partition delivery_line_list = [q.getObject() for q in self.portal.portal_catalog(
.getAggregateRelatedValueList( aggregate_relative_url=computer_partition.getRelativeUrl(),
portal_type=self.sale_packing_list_line_portal_type) portal_type=self.sale_packing_list_line_portal_type,
if q.getResource() == resource simulation_state=state,
and q.getSimulationState() == state] resource_relative_url=resource)]
self.assertEqual(delivery_line_amount, len(delivery_line_list)) self.assertEqual(delivery_line_amount, len(delivery_line_list))
def _checkComputerPartitionNoSalePackingList(self, resource, sequence): def _checkComputerPartitionNoSalePackingList(self, resource, sequence):
computer_partition = self.portal.portal_catalog.getResultValue( computer_partition = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_partition_uid']) uid=sequence['computer_partition_uid'])
delivery_line_list = [q for q in computer_partition delivery_line_list = [q.getObject() for q in self.portal.portal_catalog(
.getAggregateRelatedValueList( aggregate_relative_url=computer_partition.getRelativeUrl(),
portal_type=self.sale_packing_list_line_portal_type) portal_type=self.sale_packing_list_line_portal_type,
if q.getResource() == resource] resource_relative_url=resource)]
self.assertEqual(0, len(delivery_line_list)) self.assertEqual(0, len(delivery_line_list))
def stepLoginAsCustomerA(self, sequence):
global REMOTE_USER
REMOTE_USER = "test_vifib_customer_a"
self.login("test_vifib_customer_a")
def stepCheckComputerPartitionInstanceCleanupSalePackingListDoesNotExists(self, def stepCheckComputerPartitionInstanceCleanupSalePackingListDoesNotExists(self,
sequence, **kw): sequence, **kw):
self._checkComputerPartitionSalePackingListDoesNotExists( self._checkComputerPartitionSalePackingListDoesNotExists(
...@@ -361,7 +366,8 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -361,7 +366,8 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepPersonRequestSlaveInstance(self, sequence, **kw): def stepPersonRequestSlaveInstance(self, sequence, **kw):
kw = dict(instance_portal_type=self.slave_instance_portal_type, kw = dict(instance_portal_type=self.slave_instance_portal_type,
shared=True, shared=True,
software_type="SlaveInstance") software_type=sequence.get('requested_software_type',
'requested_software_type'))
self.stepPersonRequestSoftwareInstance(sequence, **kw) self.stepPersonRequestSoftwareInstance(sequence, **kw)
def stepPersonRequestSoftwareInstance(self, sequence, **kw): def stepPersonRequestSoftwareInstance(self, sequence, **kw):
...@@ -369,10 +375,18 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -369,10 +375,18 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
software_release = self.portal.portal_catalog.getResultValue( software_release = self.portal.portal_catalog.getResultValue(
uid=sequence['software_release_uid']) uid=sequence['software_release_uid'])
software_title = self.id() + str(random()) software_title = self.id() + str(random())
if 'software_type' not in kw:
kw['software_type'] = sequence.get('requested_software_type',
'requested_software_type')
if 'state' not in kw:
kw['state'] = sequence.get('software_instance_state')
person.requestSoftwareInstance( person.requestSoftwareInstance(
software_release=software_release.getUrlString(), software_release=software_release.getUrlString(),
software_title=software_title, software_title=software_title,
instance_xml=self.minimal_correct_xml, instance_xml=self.minimal_correct_xml,
sla_xml=sequence.get('sla_xml'),
**kw) **kw)
transaction.commit() transaction.commit()
self.tic() self.tic()
...@@ -506,6 +520,77 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -506,6 +520,77 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_reference=computer_reference, computer_reference=computer_reference,
) )
def stepCustomerRegisterNewComputer(self, sequence, **kw):
sequence['computer_title'] = str(random())
request = self.app.REQUEST
self.getPortal().portal_skins.changeSkin("Hosting")
request.set('portal_skin', "Hosting")
self.portal.web_site_module.hosting.WebSection_registerNewComputer(
title=sequence['computer_title'])
self.getPortal().portal_skins.changeSkin("View")
request.set('portal_skin', "View")
def stepSetComputerCoordinatesFromComputerTitle(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
title=sequence['computer_title'], portal_type='Computer')
sequence.edit(
computer_uid=computer.getUid(),
computer_reference=computer.getReference(),
)
def stepComputerSetAllocationScopeEmpty(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
request = self.app.REQUEST
self.getPortal().portal_skins.changeSkin("Hosting")
request.set('portal_skin', "Hosting")
computer.Computer_updateAllocationScope(allocation_scope='',
subject_list=[])
self.getPortal().portal_skins.changeSkin("View")
request.set('portal_skin', "View")
def stepComputerSetAllocationScopeOpenPersonal(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
request = self.app.REQUEST
self.getPortal().portal_skins.changeSkin("Hosting")
request.set('portal_skin', "Hosting")
computer.Computer_updateAllocationScope(allocation_scope='open/personal',
subject_list=[])
self.getPortal().portal_skins.changeSkin("View")
request.set('portal_skin', "View")
def stepComputerSetAllocationScopeClose(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
request = self.app.REQUEST
self.getPortal().portal_skins.changeSkin("Hosting")
request.set('portal_skin', "Hosting")
computer.Computer_updateAllocationScope(allocation_scope='close',
subject_list=[])
self.getPortal().portal_skins.changeSkin("View")
request.set('portal_skin', "View")
def stepComputerSetAllocationScopeOpenPublic(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
request = self.app.REQUEST
self.getPortal().portal_skins.changeSkin("Hosting")
request.set('portal_skin', "Hosting")
computer.Computer_updateAllocationScope(allocation_scope='open/public',
subject_list=[])
self.getPortal().portal_skins.changeSkin("View")
request.set('portal_skin', "View")
def stepDuplicateAndValidateCurrentComputer(self, sequence, **kw): def stepDuplicateAndValidateCurrentComputer(self, sequence, **kw):
computer = self.portal.portal_catalog.getResultValue( computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid']) uid=sequence['computer_uid'])
...@@ -538,7 +623,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -538,7 +623,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
} }
computer_dict['partition_list'].append(partition_dict) computer_dict['partition_list'].append(partition_dict)
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
self.slap.registerComputer(computer_guid).updateConfiguration( self.slap.registerComputer(computer_guid).updateConfiguration(
xml_marshaller.dumps(computer_dict)) xml_marshaller.dumps(computer_dict))
sequence.edit( sequence.edit(
...@@ -549,7 +634,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -549,7 +634,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
software_release_url = self.portal.portal_catalog.getResultValue( software_release_url = self.portal.portal_catalog.getResultValue(
uid=sequence['software_release_uid']).getUrlString() uid=sequence['software_release_uid']).getUrlString()
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
# XXX: it is impossible to do: # XXX: it is impossible to do:
# sr = self.slap.registerSoftwareRelease( # sr = self.slap.registerSoftwareRelease(
# software_release=software_release_url) # software_release=software_release_url)
...@@ -562,7 +647,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -562,7 +647,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepSoftwareInstanceStopped(self, sequence, **kw): def stepSoftwareInstanceStopped(self, sequence, **kw):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition(computer_guid, computer_partition = self.slap.registerComputerPartition(computer_guid,
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
computer_partition.stopped() computer_partition.stopped()
...@@ -570,7 +655,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -570,7 +655,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepSoftwareInstanceStarted(self, sequence, **kw): def stepSoftwareInstanceStarted(self, sequence, **kw):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition(computer_guid, computer_partition = self.slap.registerComputerPartition(computer_guid,
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
computer_partition.started() computer_partition.started()
...@@ -578,7 +663,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -578,7 +663,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepSoftwareInstanceAvailable(self, sequence, **kw): def stepSoftwareInstanceAvailable(self, sequence, **kw):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition(computer_guid, computer_partition = self.slap.registerComputerPartition(computer_guid,
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
computer_partition.available() computer_partition.available()
...@@ -586,7 +671,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -586,7 +671,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepSoftwareInstanceDestroyed(self, sequence, **kw): def stepSoftwareInstanceDestroyed(self, sequence, **kw):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition(computer_guid, computer_partition = self.slap.registerComputerPartition(computer_guid,
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
computer_partition.destroyed() computer_partition.destroyed()
...@@ -594,7 +679,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -594,7 +679,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepSoftwareInstanceBuilding(self, sequence, **kw): def stepSoftwareInstanceBuilding(self, sequence, **kw):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition(computer_guid, computer_partition = self.slap.registerComputerPartition(computer_guid,
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
computer_partition.building() computer_partition.building()
...@@ -649,13 +734,18 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -649,13 +734,18 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
Tic Tic
SetSoftwareProductToSoftwareRelease SetSoftwareProductToSoftwareRelease
PublishByActionSoftwareRelease PublishByActionSoftwareRelease
Tic
Logout Logout
""" """
prepare_computer = """ prepare_computer = """
LoginTestVifibAdmin LoginTestVifibAdmin
CreateComputer CustomerRegisterNewComputer
Tic
SetComputerCoordinatesFromComputerTitle
ComputerSetAllocationScopeOpenPublic
Tic Tic
CheckComputerTradeConditionDestinationSectionListEmpty
Logout Logout
""" """
...@@ -920,7 +1010,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -920,7 +1010,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_with_software_release = """ computer_with_software_release = """
CreateComputer CustomerRegisterNewComputer
Tic
SetComputerCoordinatesFromComputerTitle
ComputerSetAllocationScopeOpenPublic
Tic Tic
CreatePurchasePackingList CreatePurchasePackingList
Tic Tic
...@@ -996,7 +1089,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -996,7 +1089,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
prepare_another_computer_sequence_string = """ prepare_another_computer_sequence_string = """
StoreComputerReference StoreComputerReference
LoginTestVifibAdmin LoginTestVifibAdmin
CreateComputer CustomerRegisterNewComputer
Tic
SetComputerCoordinatesFromComputerTitle
ComputerSetAllocationScopeOpenPublic
Tic Tic
Logout Logout
...@@ -1052,13 +1148,21 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1052,13 +1148,21 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
# Steps # Steps
######################################## ########################################
def stepCheckComputerTradeConditionDestinationSectionListEmpty(self,
sequence, **kw):
computer = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_uid'])
trade_condition = computer.getAggregateRelatedValue(
portal_type='Sale Supply Line').getParentValue()
self.assertEqual(trade_condition.getDestinationSectionList(), [])
def stepCheckSuccessSlapRegisterComputerCall(self, sequence, **kw): def stepCheckSuccessSlapRegisterComputerCall(self, sequence, **kw):
""" """
Check that slap.registerComputer is successfully called. Check that slap.registerComputer is successfully called.
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
self.assertTrue(isinstance(computer, slap.Computer)) self.assertTrue(isinstance(computer, slap.Computer))
...@@ -1114,7 +1218,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1114,7 +1218,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
**kw): **kw):
computer_guid = sequence.get("computer_reference", str(random())) computer_guid = sequence.get("computer_reference", str(random()))
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
self.assertRaises(slap.Unauthorized, computer.getComputerPartitionList) self.assertRaises(slap.Unauthorized, computer.getComputerPartitionList)
...@@ -1123,7 +1227,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1123,7 +1227,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence.get("computer_reference", str(random())) computer_guid = sequence.get("computer_reference", str(random()))
partition_id = str(random()) partition_id = str(random())
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
self.slap.registerComputerPartition(computer_guid, partition_id) self.slap.registerComputerPartition(computer_guid, partition_id)
self.assertRaises(slap.Unauthorized, self.assertRaises(slap.Unauthorized,
self.slap.registerComputerPartition, computer_guid, partition_id) self.slap.registerComputerPartition, computer_guid, partition_id)
...@@ -1136,7 +1240,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1136,7 +1240,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = str(random()) partition_id = str(random())
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
self.assertRaises(slap.NotFoundError, self.assertRaises(slap.NotFoundError,
self.slap.registerComputerPartition, computer_guid, partition_id) self.slap.registerComputerPartition, computer_guid, partition_id)
...@@ -1181,7 +1285,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1181,7 +1285,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference_list"][0] partition_id = sequence["computer_partition_reference_list"][0]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputerPartition(computer_guid, partition_id) computer = self.slap.registerComputerPartition(computer_guid, partition_id)
self.assertTrue(isinstance(computer, slap.ComputerPartition)) self.assertTrue(isinstance(computer, slap.ComputerPartition))
...@@ -1231,7 +1335,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1231,7 +1335,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
url = sequence["software_release_uri"] url = sequence["software_release_uri"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerSoftwareRelease(url) computer = self.slap.registerSoftwareRelease(url)
self.assertTrue(isinstance(computer, slap.SoftwareRelease)) self.assertTrue(isinstance(computer, slap.SoftwareRelease))
...@@ -1360,7 +1464,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1360,7 +1464,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
self.assertRaises(slap.NotFoundError, computer.getComputerPartitionList) self.assertRaises(slap.NotFoundError, computer.getComputerPartitionList)
...@@ -1370,16 +1474,20 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1370,16 +1474,20 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
self.assertEquals([], computer.getComputerPartitionList()) self.assertEquals([], computer.getComputerPartitionList())
def stepSelectYetAnotherRequestedReference(self, sequence, **kw): def stepSelectYetAnotherRequestedReference(self, sequence, **kw):
sequence.edit(requested_reference='yet_another_requested_reference') sequence.edit(requested_reference='yet_another_requested_reference')
def stepSelectYetAnotherRequestedSoftwareType(self, sequence, **kw):
sequence.edit(requested_software_type='yet_another_requested_software_type') sequence.edit(requested_software_type='yet_another_requested_software_type')
def stepSelectAnotherRequestedReference(self, sequence, **kw): def stepSelectAnotherRequestedReference(self, sequence, **kw):
sequence.edit(requested_reference='another_requested_reference') sequence.edit(requested_reference='another_requested_reference')
def stepSelectAnotherRequestedSoftwareType(self, sequence, **kw):
sequence.edit(requested_software_type='another_requested_software_type') sequence.edit(requested_software_type='another_requested_software_type')
def stepSelectRequestedReference(self, sequence, **kw): def stepSelectRequestedReference(self, sequence, **kw):
...@@ -1438,7 +1546,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1438,7 +1546,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer = computer.getParentValue() computer = computer.getParentValue()
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
REMOTE_USER = computer.getReference() REMOTE_USER = computer.getReference()
slap_computer_partition = self.slap.registerComputerPartition( slap_computer_partition = self.slap.registerComputerPartition(
computer.getReference(), computer_partition.getReference()) computer.getReference(), computer_partition.getReference())
...@@ -1465,14 +1573,15 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1465,14 +1573,15 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
requested_parameter_dict = sequence['requested_parameter_dict'] requested_parameter_dict = sequence['requested_parameter_dict']
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
slap_computer_partition = self.slap.registerComputerPartition( slap_computer_partition = self.slap.registerComputerPartition(
sequence['computer_reference'], sequence['computer_reference'],
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
requested_slap_computer_partition = slap_computer_partition.request( requested_slap_computer_partition = slap_computer_partition.request(
software_release=software_release_uri, software_release=software_release_uri,
software_type="SlaveInstance", software_type=sequence.get('requested_software_type',
'requested_software_type'),
partition_reference=requested_reference, partition_reference=requested_reference,
partition_parameter_kw=requested_parameter_dict, partition_parameter_kw=requested_parameter_dict,
# XXX The follow API should be slave, but shared was kept for # XXX The follow API should be slave, but shared was kept for
...@@ -1495,7 +1604,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1495,7 +1604,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
requested_parameter_dict = sequence['requested_parameter_dict'] requested_parameter_dict = sequence['requested_parameter_dict']
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
slap_computer_partition = self.slap.registerComputerPartition( slap_computer_partition = self.slap.registerComputerPartition(
sequence['computer_reference'], sequence['computer_reference'],
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
...@@ -1503,7 +1612,8 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1503,7 +1612,8 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.assertRaises(slap.NotFoundError, self.assertRaises(slap.NotFoundError,
slap_computer_partition.request, slap_computer_partition.request,
software_release=software_release_uri, software_release=software_release_uri,
software_type="SlaveInstance", software_type=sequence.get('requested_software_type',
'requested_software_type'),
partition_reference=requested_reference, partition_reference=requested_reference,
partition_parameter_kw=requested_parameter_dict, partition_parameter_kw=requested_parameter_dict,
shared=True, shared=True,
...@@ -1512,7 +1622,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1512,7 +1622,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepRequestTwoAndCheckDifferentResult(self, sequence, **kw): def stepRequestTwoAndCheckDifferentResult(self, sequence, **kw):
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
slap_computer_partition = self.slap.registerComputerPartition( slap_computer_partition = self.slap.registerComputerPartition(
sequence['computer_reference'], sequence['computer_reference'],
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
...@@ -1534,7 +1644,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1534,7 +1644,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepRequestComputerPartition(self, sequence, **kw): def stepRequestComputerPartition(self, sequence, **kw):
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
slap_computer_partition = self.slap.registerComputerPartition( slap_computer_partition = self.slap.registerComputerPartition(
sequence['computer_reference'], sequence['computer_reference'],
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
...@@ -1557,7 +1667,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1557,7 +1667,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepRequestComputerPartitionNotFoundResponse(self, sequence, **kw): def stepRequestComputerPartitionNotFoundResponse(self, sequence, **kw):
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
slap_computer_partition = self.slap.registerComputerPartition( slap_computer_partition = self.slap.registerComputerPartition(
sequence['computer_reference'], sequence['computer_reference'],
sequence['computer_partition_reference']) sequence['computer_partition_reference'])
...@@ -1919,7 +2029,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1919,7 +2029,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
computer_partition_list = computer.getComputerPartitionList() computer_partition_list = computer.getComputerPartitionList()
self.assertEquals(self.computer_partition_amount, self.assertEquals(self.computer_partition_amount,
...@@ -1932,7 +2042,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1932,7 +2042,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference_list"][0] partition_id = sequence["computer_partition_reference_list"][0]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
self.assertEquals(partition_id, computer_partition.getId()) self.assertEquals(partition_id, computer_partition.getId())
...@@ -1943,7 +2053,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1943,7 +2053,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
url = sequence["software_release_uri"] url = sequence["software_release_uri"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
software_release = self.slap.registerSoftwareRelease(url) software_release = self.slap.registerSoftwareRelease(url)
self.assertEquals(url, software_release.getURI()) self.assertEquals(url, software_release.getURI())
...@@ -1955,7 +2065,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1955,7 +2065,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence.get("computer_reference", str(random())) computer_guid = sequence.get("computer_reference", str(random()))
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
self.assertRaises(slap.Unauthorized, computer.getSoftwareReleaseList) self.assertRaises(slap.Unauthorized, computer.getSoftwareReleaseList)
...@@ -1966,7 +2076,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1966,7 +2076,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
self.assertRaises(slap.NotFoundError, computer.getSoftwareReleaseList) self.assertRaises(slap.NotFoundError, computer.getSoftwareReleaseList)
...@@ -1976,7 +2086,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1976,7 +2086,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
self.assertEquals([], computer.getSoftwareReleaseList()) self.assertEquals([], computer.getSoftwareReleaseList())
...@@ -1987,7 +2097,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1987,7 +2097,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
self.assertEquals(1, len(computer.getSoftwareReleaseList())) self.assertEquals(1, len(computer.getSoftwareReleaseList()))
self.assertTrue(isinstance(computer.getSoftwareReleaseList()[0], self.assertTrue(isinstance(computer.getSoftwareReleaseList()[0],
...@@ -2074,7 +2184,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2074,7 +2184,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
url = sequence["software_release_uri"] url = sequence["software_release_uri"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
software_release = self.slap.registerSoftwareRelease(url) software_release = self.slap.registerSoftwareRelease(url)
self.assertRaises(slap.NotFoundError, software_release.building) self.assertRaises(slap.NotFoundError, software_release.building)
...@@ -2085,7 +2195,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2085,7 +2195,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
software_release = computer.getSoftwareReleaseList()[0] software_release = computer.getSoftwareReleaseList()[0]
...@@ -2110,7 +2220,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2110,7 +2220,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepCheckNotFoundSoftwareReleaseBuildingCall(self, sequence, **kw): def stepCheckNotFoundSoftwareReleaseBuildingCall(self, sequence, **kw):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
software_release = self.slap.registerSoftwareRelease( software_release = self.slap.registerSoftwareRelease(
sequence['software_release_uri']) sequence['software_release_uri'])
# Note: Hackish # Note: Hackish
...@@ -2124,7 +2234,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2124,7 +2234,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
software_release = computer.getSoftwareReleaseList()[0] software_release = computer.getSoftwareReleaseList()[0]
...@@ -2140,7 +2250,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2140,7 +2250,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
software_release = self.slap.registerSoftwareRelease( software_release = self.slap.registerSoftwareRelease(
sequence['software_release_uri']) sequence['software_release_uri'])
# Note: Hackish # Note: Hackish
...@@ -2154,7 +2264,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2154,7 +2264,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
software_release = computer.getSoftwareReleaseList()[0] software_release = computer.getSoftwareReleaseList()[0]
...@@ -2166,7 +2276,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2166,7 +2276,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepCheckSoftwareReleaseErrorCall(self, sequence, **kw): def stepCheckSoftwareReleaseErrorCall(self, sequence, **kw):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
software_release = self.slap.registerSoftwareRelease( software_release = self.slap.registerSoftwareRelease(
sequence['software_release_uri']) sequence['software_release_uri'])
# Note: Hackish # Note: Hackish
...@@ -2180,7 +2290,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2180,7 +2290,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
software_release = computer.getSoftwareReleaseList()[0] software_release = computer.getSoftwareReleaseList()[0]
...@@ -2196,7 +2306,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2196,7 +2306,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
software_release = computer.getSoftwareReleaseList()[0] software_release = computer.getSoftwareReleaseList()[0]
...@@ -2213,7 +2323,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2213,7 +2323,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
url = sequence["software_release_uri"] url = sequence["software_release_uri"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
software_release = self.slap.registerSoftwareRelease(url) software_release = self.slap.registerSoftwareRelease(url)
self.assertRaises(slap.NotFoundError, software_release.available) self.assertRaises(slap.NotFoundError, software_release.available)
...@@ -2224,7 +2334,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2224,7 +2334,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
software_release = computer.getSoftwareReleaseList()[0] software_release = computer.getSoftwareReleaseList()[0]
...@@ -2236,7 +2346,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2236,7 +2346,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
software_release = computer.getSoftwareReleaseList()[0] software_release = computer.getSoftwareReleaseList()[0]
...@@ -2266,7 +2376,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2266,7 +2376,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
url = sequence["software_release_uri"] url = sequence["software_release_uri"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
software_release = self.slap.registerSoftwareRelease(url) software_release = self.slap.registerSoftwareRelease(url)
self.assertRaises(slap.NotFoundError, software_release.error, "ErrorLog") self.assertRaises(slap.NotFoundError, software_release.error, "ErrorLog")
...@@ -2277,7 +2387,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2277,7 +2387,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
software_release = computer.getSoftwareReleaseList()[0] software_release = computer.getSoftwareReleaseList()[0]
...@@ -2313,7 +2423,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2313,7 +2423,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
software_release = computer.getSoftwareReleaseList()[0] software_release = computer.getSoftwareReleaseList()[0]
...@@ -2326,7 +2436,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2326,7 +2436,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
""" """
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer = self.slap.registerComputer(computer_guid) computer = self.slap.registerComputer(computer_guid)
software_release = computer.getSoftwareReleaseList()[0] software_release = computer.getSoftwareReleaseList()[0]
...@@ -2342,7 +2452,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2342,7 +2452,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2356,7 +2466,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2356,7 +2466,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2370,7 +2480,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2370,7 +2480,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2465,7 +2575,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2465,7 +2575,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference_list"][0] partition_id = sequence["computer_partition_reference_list"][0]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2530,7 +2640,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2530,7 +2640,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2547,7 +2657,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2547,7 +2657,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2565,7 +2675,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2565,7 +2675,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference_list"][0] partition_id = sequence["computer_partition_reference_list"][0]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2578,7 +2688,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2578,7 +2688,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2591,7 +2701,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2591,7 +2701,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2604,7 +2714,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2604,7 +2714,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
computer_partition.destroyed() computer_partition.destroyed()
...@@ -2617,7 +2727,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2617,7 +2727,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
self.assertRaises(slap.NotFoundError, computer_partition.destroyed) self.assertRaises(slap.NotFoundError, computer_partition.destroyed)
...@@ -2629,7 +2739,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2629,7 +2739,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2644,7 +2754,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2644,7 +2754,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2662,7 +2772,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2662,7 +2772,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference_list"][0] partition_id = sequence["computer_partition_reference_list"][0]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
self.slap.registerComputerPartition( self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2673,7 +2783,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2673,7 +2783,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
self.assertRaises(slap.NotFoundError, computer_partition.error, "ErrorLog") self.assertRaises(slap.NotFoundError, computer_partition.error, "ErrorLog")
...@@ -2685,7 +2795,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2685,7 +2795,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
computer_partition.error("ErrorLog") computer_partition.error("ErrorLog")
...@@ -2783,7 +2893,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2783,7 +2893,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2801,7 +2911,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2801,7 +2911,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference_list"][0] partition_id = sequence["computer_partition_reference_list"][0]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2815,7 +2925,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2815,7 +2925,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2832,7 +2942,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2832,7 +2942,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2847,7 +2957,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2847,7 +2957,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2864,7 +2974,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2864,7 +2974,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2877,7 +2987,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2877,7 +2987,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2889,7 +2999,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2889,7 +2999,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
'slap_computer_partition_id': partition_id, 'slap_computer_partition_id': partition_id,
'slap_server_url': self.server_url, 'slap_server_url': self.server_url,
'slap_software_release_url': software_release_uri, 'slap_software_release_url': software_release_uri,
'slap_software_type': 'RootSoftwareInstance', 'slap_software_type':
sequence.get('requested_software_type',
'requested_software_type'),
'slave_instance_list': [], 'slave_instance_list': [],
'ip_list': [], 'ip_list': [],
} }
...@@ -2975,7 +3087,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2975,7 +3087,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -2988,7 +3100,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -2988,7 +3100,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
'slap_computer_partition_id': partition_id, 'slap_computer_partition_id': partition_id,
'slap_server_url': self.server_url, 'slap_server_url': self.server_url,
'slap_software_release_url': software_release_uri, 'slap_software_release_url': software_release_uri,
'slap_software_type': 'RootSoftwareInstance', 'slap_software_type':
sequence.get('requested_software_type',
'requested_software_type'),
'test_parameter': 'lala', 'test_parameter': 'lala',
'slave_instance_list': [], 'slave_instance_list': [],
'ip_list': [], 'ip_list': [],
...@@ -3002,7 +3116,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3002,7 +3116,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -3015,7 +3129,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3015,7 +3129,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -3028,7 +3142,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3028,7 +3142,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -3042,7 +3156,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3042,7 +3156,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
partition_id = sequence.get("computer_partition_reference", partition_id = sequence.get("computer_partition_reference",
sequence['computer_partition_reference_list'][0]) sequence['computer_partition_reference_list'][0])
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -3057,7 +3171,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3057,7 +3171,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_guid, partition_id) computer_guid, partition_id)
...@@ -3294,7 +3408,11 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3294,7 +3408,11 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepSetCurrentSoftwareInstanceRequested(self, sequence): def stepSetCurrentSoftwareInstanceRequested(self, sequence):
sequence.edit( sequence.edit(
requester_software_instance_uid=sequence['software_instance_uid'], requester_software_instance_uid=sequence['software_instance_uid'],
requester_software_instance_reference=sequence[
'software_instance_reference'],
software_instance_uid=sequence['requested_software_instance_uid'], software_instance_uid=sequence['requested_software_instance_uid'],
software_instance_reference=sequence[
'requested_software_instance_reference']
) )
def stepSetCurrentSoftwareInstanceRequester(self, sequence): def stepSetCurrentSoftwareInstanceRequester(self, sequence):
...@@ -3388,7 +3506,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3388,7 +3506,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.assertEquals("confirmed", sale_order_line.getSimulationState()) self.assertEquals("confirmed", sale_order_line.getSimulationState())
sale_packing_list_line = slave_instance.getAggregateRelatedValue( sale_packing_list_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_packing_list_line_portal_type) portal_type=self.sale_packing_list_line_portal_type)
self.assertNotEquals(sale_packing_list_line.getAggregateValue( self.assertNotEquals(sale_packing_list_line.getAggregate(
portal_type=self.computer_partition_portal_type), None) portal_type=self.computer_partition_portal_type), None)
def stepCheckSlaveInstanceAssociationWithSoftwareInstance(self, sequence): def stepCheckSlaveInstanceAssociationWithSoftwareInstance(self, sequence):
...@@ -3419,13 +3537,11 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3419,13 +3537,11 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
portal_type=self.software_release_portal_type) portal_type=self.software_release_portal_type)
sale_packing_list_line_list = software_release.aggregateRelatedValues( sale_packing_list_line_list = software_release.aggregateRelatedValues(
portal_type=self.sale_packing_list_line_portal_type) portal_type=self.sale_packing_list_line_portal_type)
computer_partition_list = [obj.getAggregateValue( computer_partition_list = [obj.getAggregate(
portal_type=self.computer_partition_portal_type)\ portal_type=self.computer_partition_portal_type)\
for obj in sale_packing_list_line_list] for obj in sale_packing_list_line_list]
self.assertEquals(computer_partition_list[0], self.assertEquals(computer_partition_list[0],
computer_partition_list[1]) computer_partition_list[1])
self.assertEquals(computer_partition_list[0].getReference(),
computer_partition_list[1].getReference())
self.assertEquals(2, len(computer_partition_list)) self.assertEquals(2, len(computer_partition_list))
def stepCheckSlaveInstanceNotReady(self, sequence): def stepCheckSlaveInstanceNotReady(self, sequence):
...@@ -3449,7 +3565,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3449,7 +3565,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition(computer_guid, computer_partition = self.slap.registerComputerPartition(computer_guid,
partition_id) partition_id)
parameter_dict = computer_partition.getInstanceParameterDict() parameter_dict = computer_partition.getInstanceParameterDict()
...@@ -3461,16 +3577,21 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3461,16 +3577,21 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
partition_id = sequence["computer_partition_reference"] partition_id = sequence["computer_partition_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition(computer_guid, computer_partition = self.slap.registerComputerPartition(computer_guid,
partition_id) partition_id)
parameter_dict = computer_partition.getInstanceParameterDict() parameter_dict = computer_partition.getInstanceParameterDict()
self.assertEquals("RootSoftwareInstance", self.assertEquals(
sequence.get('requested_software_type',
'requested_software_type'),
parameter_dict["slap_software_type"]) parameter_dict["slap_software_type"])
slave_instance_list = parameter_dict["slave_instance_list"] slave_instance_list = parameter_dict["slave_instance_list"]
self.assertEquals(expected_amount, len(slave_instance_list)) self.assertEquals(expected_amount, len(slave_instance_list))
for slave_instance in slave_instance_list: for slave_instance in slave_instance_list:
self.assertEquals("SlaveInstance", slave_instance["slap_software_type"]) self.assertEquals(
sequence.get('requested_software_type',
'requested_software_type'),
slave_instance["slap_software_type"])
def stepCheckTwoSlaveInstanceListFromOneComputerPartition(self, sequence): def stepCheckTwoSlaveInstanceListFromOneComputerPartition(self, sequence):
self.stepCheckSlaveInstanceListFromOneComputerPartition(sequence, self.stepCheckSlaveInstanceListFromOneComputerPartition(sequence,
...@@ -3583,7 +3704,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3583,7 +3704,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
connection_dict = dict(site_url=site_url) connection_dict = dict(site_url=site_url)
slave_reference = sequence["software_instance_reference"] slave_reference = sequence["software_instance_reference"]
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url) self.slap.initializeConnection(self.server_url, timeout=None)
computer_partition = self.slap.registerComputerPartition( computer_partition = self.slap.registerComputerPartition(
computer_reference, computer_partition_reference) computer_reference, computer_partition_reference)
computer_partition.setConnectionDict(connection_dict) computer_partition.setConnectionDict(connection_dict)
...@@ -3688,646 +3809,6 @@ class TestVifibSlapWebService(TestVifibSlapWebServiceMixin): ...@@ -3688,646 +3809,6 @@ class TestVifibSlapWebService(TestVifibSlapWebServiceMixin):
""" """
raise NotImplementedError raise NotImplementedError
#########################################
# SlaveInstance.request
#########################################
def stepLoginAsCustomerA(self, sequence):
global REMOTE_USER
REMOTE_USER = "test_vifib_customer_a"
self.login("test_vifib_customer_a")
def test_SlaveInstance_Person_request_with_Different_User(self):
"""
Check that user B can declare a slot of slave instance in computer
partition used by user A
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
SlapLogout
LoginAsCustomerA
PersonRequestSlaveInstance
Logout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckComputerPartitionSaleOrderAggregatedList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_after_destroy_SlaveInstance(self):
"""
Check that a Slave Instance will not be allocated when a Software
Instance is destroyed
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_installed_computer_partition_sequence_string + """
LoginTestVifibCustomer
RequestSoftwareInstanceDestroy
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
SlapLogout
LoginTestVifibCustomer
PersonRequestSlaveInstance
Tic
Logout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSlaveInstanceNotReady
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Person_request_SlaveInstance(self):
"""
Check that one Slave Instance is created correctly
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
Tic
Logout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionSaleOrderAggregatedList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_getInstanceParameterDict_with_SlaveInstance_stopped(self):
"""
Check that the Slave Instance is ignored when the state of Sale Packing
List in stopped.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLogout
LoginTestVifibCustomer
SlaveInstanceStopComputerPartitionInstallation
Tic
SlaveInstanceStarted
Tic
SlaveInstanceStopped
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListDelivered
SlapLoginCurrentComputer
CheckEmptySlaveInstanceListFromOneComputerPartition
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_getInstanceParameterDict_with_two_SlaveInstance(self):
"""
Check that with two Slave Instance installed in different computers, the
method getInstanceParameterDict returns correctly the slave instance list
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic """ + self.prepare_formated_computer + """
Tic
LoginTestVifibDeveloper \
SelectNewSoftwareReleaseUri \
CreateSoftwareRelease \
Tic \
SubmitSoftwareRelease \
Tic \
CreateSoftwareProduct \
Tic \
ValidateSoftwareProduct \
Tic \
SetSoftwareProductToSoftwareRelease \
PublishByActionSoftwareRelease \
Tic
Logout \
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
Tic
LoginTestVifibCustomer
PersonRequestSoftwareInstance
ConfirmOrderedSaleOrderActiveSense
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
CheckSlaveInstanceListFromOneComputerPartition
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Person_request_without_SoftwareInstance(self):
"""
Check that one Slave Instance will wait allocation correctly when no
exists Software Instance installed
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + \
self.prepare_published_software_release + """
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
Tic
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSlaveInstanceNotReady
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Person_request_with_Two_Different_ComputerPartition(self):
"""
Check that one Slave Instance is allocated correctly when exists two different
Software Instances and Computer Partition. The slave instance must be
allocated in Computer Partition that exists one Software Instance with
the same Software Release.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
StoreSoftwareReleaseUri
SetRandomComputerReference
""" + self.prepare_install_requested_computer_partition_sequence_string + """
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
Tic
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSlaveInstanceReady
CheckSlaveInstanceAllocationWithTwoDifferentSoftwareInstance
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Person_request_with_Two_Different_SoftwareInstance(self):
"""
Check that one Slave Instance is allocated correctly when exists two different
Software Instances. The slave instance must be allocated in the same
Computer Partition that exists one Software Instance installed.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
StoreSoftwareReleaseUri
LoginTestVifibCustomer
PersonRequestSlaveInstance
ConfirmOrderedSaleOrderActiveSense
Tic
""" + self.prepare_published_software_release + """
Tic
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
LoginTestVifibCustomer
PersonRequestSoftwareInstance
ConfirmOrderedSaleOrderActiveSense
Tic
SelectDifferentSoftwareReleaseUri
LoginTestVifibCustomer
PersonRequestSlaveInstance
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSlaveInstanceAssociationWithSoftwareInstance
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Person_request_twice(self):
"""
Check that request a Slave Instance twice, the instances are created
correctly
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
LoginAsCustomerA
PersonRequestSlaveInstance
SlapLogout
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckTwoSlaveInstanceRequest
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
@skip("Not Implemented yet")
def test_request_SlaveInstance_without_enough_slots(self):
"""
Check the behaviour when one Slave Instance is requested and not exist one
available slot
"""
raise NotImplementedError
def test_SlaveInstance_request_start_when_SoftwareInstance_is_started(self):
"""
Check that the Slave Instance will be started correctly
XXX - Review the sequence of steps to verify that the scenario is
validating the feature of start a Instance Slave
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
SoftwareInstanceStarted
Tic
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceHostingSalePackingListStarted
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_stop_from_SoftwareInstance(self):
"""
Check that the Slave Instance will be stopped correctly when
a Software Instance is stopped
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
LoginTestVifibCustomer
StartSoftwareInstanceFromCurrentComputerPartition
Tic
SoftwareInstanceStarted
Tic
SoftwareInstanceStopped
Tic
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceHostingSalePackingListDelivered
CheckComputerPartitionInstanceSetupSalePackingListStopped
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_start_from_SoftwareInstance(self):
"""
Check that the Slave Instance will be started correctly when
a Software Instance is started
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLogout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
LoginTestVifibCustomer
StartSoftwareInstanceFromCurrentComputerPartition
Tic
Logout
SlapLoginCurrentComputer
SoftwareInstanceStarted
Tic
SlapLogout
LoginDefaultUser
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceHostingSalePackingListStarted
CheckComputerPartitionInstanceSetupSalePackingListStopped
LoginTestVifibCustomer
RequestStopSoftwareInstanceFromCurrentComputerPartition
Tic
SlapLoginCurrentComputer
SoftwareInstanceStopped
Tic
CheckComputerPartitionInstanceHostingSalePackingListDelivered
StartSoftwareInstanceFromCurrentComputerPartition
Tic
SoftwareInstanceStarted
Tic
RequestStopSoftwareInstanceFromCurrentComputerPartition
Tic
SlapLoginCurrentComputer
SoftwareInstanceStopped
Tic
StartSoftwareInstanceFromCurrentComputerPartition
Tic
SoftwareInstanceStarted
Tic
CheckComputerPartitionInstanceHostingSalePackingListStarted
SetDeliveryLineAmountEqualZero
CheckComputerPartitionInstanceHostingSalePackingListConfirmed
Logout
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLogout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
LoginTestVifibCustomer
RequestSoftwareInstanceStart
Tic
Logout
SlapLoginCurrentComputer
SoftwareInstanceStarted
Tic
SetDeliveryLineAmountEqualThree
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListStarted
RequestStopSoftwareInstanceFromCurrentComputerPartition
Tic
SlapLoginCurrentComputer
SoftwareInstanceStopped
Tic
LoginTestVifibCustomer
StartSoftwareInstanceFromCurrentComputerPartition
Tic
SlapLoginCurrentComputer
SoftwareInstanceStarted
Tic
CheckComputerPartitionInstanceHostingSalePackingListStarted
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_call_destroy_from_SoftwareInstance(self):
"""
Check that the Slave Instance will be stopped correctly when
a Software Instance is destroyed
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_slave_instance_sequence_string + """
LoginTestVifibCustomer
RequestDestroySoftwareInstanceFromCurrentComputerPartition
Tic
SetDeliveryLineAmountEqualOne
CheckComputerPartitionInstanceHostingSalePackingListStopped
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
SlapLoginSoftwareInstanceFromCurrentSoftwareInstance
SoftwareInstanceDestroyed
Tic
CheckComputerPartitionInstanceHostingSalePackingListStopped
CheckComputerPartitionInstanceCleanupSalePackingListDelivered
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_stop(self):
"""
Check that the Slave Instance will be stopped correctly
XXX - Review the sequence of steps to verify that the scenario is
validating the feature of stop a Instance Slave
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + """
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
CheckSuccessComputerGetComputerPartitionCall
SoftwareInstanceStarted
Tic
SlapLogout
LoginTestVifibCustomer
RequestSlaveInstanceStop
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListStopped
Logout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
SoftwareInstanceStarted
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListDelivered
Logout
LoginTestVifibCustomer
RequestStopSoftwareInstanceFromCurrentComputerPartition
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListStopped
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_destroy(self):
"""
Check that the Slave Instance will be destroyed correctly
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
LoginTestVifibCustomer
RequestSoftwareInstanceDestroy
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_check_permission_with_different_customer(self):
"""
Check that one Customer A can not view the Slave Instance of a Customer B
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
Tic
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLogout
LoginAsCustomerA
CheckSlaveInstanceSecurityWithDifferentCustomer
PersonRequestSlaveInstance
Tic
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
SlapLogout
LoginTestVifibCustomer
CheckSlaveInstanceSecurityWithDifferentCustomer
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Information_with_getInstanceParameterDict(self):
"""
Check that Computer Partition of user A is reinstanciated with new
parameters provided by user B. User B and Aget the right connection
parameter
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
SlapLoginCurrentComputer
CheckEmptySlaveInstanceListFromOneComputerPartition
LoginAsCustomerA
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
CheckSlaveInstanceListFromOneComputerPartition
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_security_with_SoftwareInstance_user(self):
"""
Check that the software instance user can access a Slave Instance
installed in the same computer partition than your software instance
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
SlapLoginCurrentComputer
CheckEmptySlaveInstanceListFromOneComputerPartition
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
StoreSalePackingListLineFromSlaveInstance
StoreSaleOrderFromSlaveInstance
SlapLoginCurrentComputer
CheckSlaveInstanceListFromOneComputerPartition
SlapLoginSoftwareInstanceFromCurrentSoftwareInstance
CheckSlaveInstanceAccessUsingCurrentSoftwareInstanceUser
CheckSalePackingListFromSlaveInstanceAccessUsingSoftwareInstanceUser
CheckSaleOrderFromSlaveInstanceAccessUsingSoftwareInstanceUser
CheckHostingSubscriptionFromSlaveInstanceAccessUsingSoftwareInstanceUser
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_update_connection_xml(self):
"""
Check that the connection_xml will be update correctly using portal_slap
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
SlapLoginCurrentComputer
CheckEmptySlaveInstanceListFromOneComputerPartition
LoginAsCustomerA
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginSoftwareInstanceFromCurrentSoftwareInstance
SetConnectionXmlToSlaveInstance
CheckConnectionXmlFromSlaveInstance
CheckConnectionXmlFromSoftwareInstance
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
######################################## ########################################
# ComputerPartition.getId # ComputerPartition.getId
######################################## ########################################
......
from testVifibSlapWebService import TestVifibSlapWebServiceMixin
from Products.ERP5Type.tests.Sequence import SequenceList
import unittest
from Products.ERP5Type.tests.backportUnittest import skip
class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
def test_SlaveInstance_Person_request_with_Different_User(self):
"""
Check that user B can declare a slot of slave instance in computer
partition used by user A
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
SlapLogout
LoginAsCustomerA
PersonRequestSlaveInstance
Logout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckComputerPartitionSaleOrderAggregatedList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_after_destroy_SlaveInstance(self):
"""
Check that a Slave Instance will not be allocated when a Software
Instance is destroyed
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_installed_computer_partition_sequence_string + """
LoginTestVifibCustomer
RequestSoftwareInstanceDestroy
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
SlapLogout
LoginTestVifibCustomer
PersonRequestSlaveInstance
Tic
Logout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSlaveInstanceNotReady
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Person_request_SlaveInstance(self):
"""
Check that one Slave Instance is created correctly
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
Tic
Logout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionSaleOrderAggregatedList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_getInstanceParameterDict_with_SlaveInstance_stopped(self):
"""
Check that the Slave Instance is ignored when the state of Sale Packing
List in stopped.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLogout
LoginTestVifibCustomer
SlaveInstanceStopComputerPartitionInstallation
Tic
SlaveInstanceStarted
Tic
SlaveInstanceStopped
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListDelivered
SlapLoginCurrentComputer
CheckEmptySlaveInstanceListFromOneComputerPartition
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_getInstanceParameterDict_with_two_SlaveInstance(self):
"""
Check that with two Slave Instance installed in different computers, the
method getInstanceParameterDict returns correctly the slave instance list
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic """ + self.prepare_formated_computer + """
Tic
LoginTestVifibDeveloper \
SelectNewSoftwareReleaseUri \
CreateSoftwareRelease \
Tic \
SubmitSoftwareRelease \
Tic \
CreateSoftwareProduct \
Tic \
ValidateSoftwareProduct \
Tic \
SetSoftwareProductToSoftwareRelease \
PublishByActionSoftwareRelease \
Tic
Logout \
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
Tic
LoginTestVifibCustomer
PersonRequestSoftwareInstance
ConfirmOrderedSaleOrderActiveSense
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
CheckSlaveInstanceListFromOneComputerPartition
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Person_request_without_SoftwareInstance(self):
"""
Check that one Slave Instance will wait allocation correctly when no
exists Software Instance installed
"""
sequence_list = SequenceList()
sequence_string = self.prepare_formated_computer + \
self.prepare_published_software_release + """
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
Tic
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSlaveInstanceNotReady
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Person_request_with_Two_Different_ComputerPartition(self):
"""
Check that one Slave Instance is allocated correctly when exists two different
Software Instances and Computer Partition. The slave instance must be
allocated in Computer Partition that exists one Software Instance with
the same Software Release.
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
StoreSoftwareReleaseUri
SetRandomComputerReference
""" + self.prepare_install_requested_computer_partition_sequence_string + """
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
Tic
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSlaveInstanceReady
CheckSlaveInstanceAllocationWithTwoDifferentSoftwareInstance
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Person_request_with_Two_Different_SoftwareInstance(self):
"""
Check that one Slave Instance is allocated correctly when exists two different
Software Instances. The slave instance must be allocated in the same
Computer Partition that exists one Software Instance installed.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
StoreSoftwareReleaseUri
LoginTestVifibCustomer
PersonRequestSlaveInstance
ConfirmOrderedSaleOrderActiveSense
Tic
""" + self.prepare_published_software_release + """
Tic
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
LoginTestVifibCustomer
PersonRequestSoftwareInstance
ConfirmOrderedSaleOrderActiveSense
Tic
SelectDifferentSoftwareReleaseUri
LoginTestVifibCustomer
PersonRequestSlaveInstance
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSlaveInstanceAssociationWithSoftwareInstance
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Person_request_twice(self):
"""
Check that request a Slave Instance twice, the instances are created
correctly
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
LoginAsCustomerA
PersonRequestSlaveInstance
SlapLogout
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckTwoSlaveInstanceRequest
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
@skip("Not Implemented yet")
def test_request_SlaveInstance_without_enough_slots(self):
"""
Check the behaviour when one Slave Instance is requested and not exist one
available slot
"""
raise NotImplementedError
def test_SlaveInstance_request_start_when_SoftwareInstance_is_started(self):
"""
Check that the Slave Instance will be started correctly
XXX - Review the sequence of steps to verify that the scenario is
validating the feature of start a Instance Slave
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
SoftwareInstanceStarted
Tic
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceHostingSalePackingListStarted
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_stop_from_SoftwareInstance(self):
"""
Check that the Slave Instance will be stopped correctly when
a Software Instance is stopped
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
LoginTestVifibCustomer
StartSoftwareInstanceFromCurrentComputerPartition
Tic
SoftwareInstanceStarted
Tic
SoftwareInstanceStopped
Tic
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceHostingSalePackingListDelivered
CheckComputerPartitionInstanceSetupSalePackingListStopped
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_start_from_SoftwareInstance(self):
"""
Check that the Slave Instance will be started correctly when
a Software Instance is started
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLogout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
LoginTestVifibCustomer
StartSoftwareInstanceFromCurrentComputerPartition
Tic
Logout
SlapLoginCurrentComputer
SoftwareInstanceStarted
Tic
SlapLogout
LoginDefaultUser
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceHostingSalePackingListStarted
CheckComputerPartitionInstanceSetupSalePackingListStopped
LoginTestVifibCustomer
RequestStopSoftwareInstanceFromCurrentComputerPartition
Tic
SlapLoginCurrentComputer
SoftwareInstanceStopped
Tic
CheckComputerPartitionInstanceHostingSalePackingListDelivered
StartSoftwareInstanceFromCurrentComputerPartition
Tic
SoftwareInstanceStarted
Tic
RequestStopSoftwareInstanceFromCurrentComputerPartition
Tic
SlapLoginCurrentComputer
SoftwareInstanceStopped
Tic
StartSoftwareInstanceFromCurrentComputerPartition
Tic
SoftwareInstanceStarted
Tic
CheckComputerPartitionInstanceHostingSalePackingListStarted
SetDeliveryLineAmountEqualZero
CheckComputerPartitionInstanceHostingSalePackingListConfirmed
Logout
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLogout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
LoginTestVifibCustomer
RequestSoftwareInstanceStart
Tic
Logout
SlapLoginCurrentComputer
SoftwareInstanceStarted
Tic
SetDeliveryLineAmountEqualThree
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListStarted
RequestStopSoftwareInstanceFromCurrentComputerPartition
Tic
SlapLoginCurrentComputer
SoftwareInstanceStopped
Tic
LoginTestVifibCustomer
StartSoftwareInstanceFromCurrentComputerPartition
Tic
SlapLoginCurrentComputer
SoftwareInstanceStarted
Tic
CheckComputerPartitionInstanceHostingSalePackingListStarted
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_call_destroy_from_SoftwareInstance(self):
"""
Check that the Slave Instance will be stopped correctly when
a Software Instance is destroyed
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_slave_instance_sequence_string + """
LoginTestVifibCustomer
RequestDestroySoftwareInstanceFromCurrentComputerPartition
Tic
SetDeliveryLineAmountEqualOne
CheckComputerPartitionInstanceHostingSalePackingListStopped
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
SlapLoginCurrentComputer
SoftwareInstanceDestroyed
Tic
CheckComputerPartitionInstanceHostingSalePackingListStopped
CheckComputerPartitionInstanceCleanupSalePackingListDelivered
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_stop(self):
"""
Check that the Slave Instance will be stopped correctly
XXX - Review the sequence of steps to verify that the scenario is
validating the feature of stop a Instance Slave
"""
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + """
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
CheckSuccessComputerGetComputerPartitionCall
SoftwareInstanceStarted
Tic
SlapLogout
LoginTestVifibCustomer
RequestSlaveInstanceStop
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListStopped
Logout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
SoftwareInstanceStarted
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListDelivered
Logout
LoginTestVifibCustomer
RequestStopSoftwareInstanceFromCurrentComputerPartition
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListStopped
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_request_destroy(self):
"""
Check that the Slave Instance will be destroyed correctly
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
LoginTestVifibCustomer
RequestSoftwareInstanceDestroy
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_check_permission_with_different_customer(self):
"""
Check that one Customer A can not view the Slave Instance of a Customer B
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
LoginTestVifibCustomer
PersonRequestSlaveInstance
Tic
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLogout
LoginAsCustomerA
CheckSlaveInstanceSecurityWithDifferentCustomer
PersonRequestSlaveInstance
Tic
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
SlapLogout
LoginTestVifibCustomer
CheckSlaveInstanceSecurityWithDifferentCustomer
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_Information_with_getInstanceParameterDict(self):
"""
Check that Computer Partition of user A is reinstanciated with new
parameters provided by user B. User B and Aget the right connection
parameter
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
SlapLoginCurrentComputer
CheckEmptySlaveInstanceListFromOneComputerPartition
LoginAsCustomerA
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentComputer
CheckSlaveInstanceListFromOneComputerPartition
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_security_with_SoftwareInstance_user(self):
"""
Check that the software instance user can access a Slave Instance
installed in the same computer partition than your software instance
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
SlapLoginCurrentComputer
CheckEmptySlaveInstanceListFromOneComputerPartition
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
StoreSalePackingListLineFromSlaveInstance
StoreSaleOrderFromSlaveInstance
SlapLoginCurrentComputer
CheckSlaveInstanceListFromOneComputerPartition
SlapLoginSoftwareInstanceFromCurrentSoftwareInstance
CheckSlaveInstanceAccessUsingCurrentSoftwareInstanceUser
CheckSalePackingListFromSlaveInstanceAccessUsingSoftwareInstanceUser
CheckSaleOrderFromSlaveInstanceAccessUsingSoftwareInstanceUser
CheckHostingSubscriptionFromSlaveInstanceAccessUsingSoftwareInstanceUser
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_SlaveInstance_update_connection_xml(self):
"""
Check that the connection_xml will be update correctly using portal_slap
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
SlapLoginCurrentComputer
CheckEmptySlaveInstanceListFromOneComputerPartition
LoginAsCustomerA
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginSoftwareInstanceFromCurrentSoftwareInstance
SetConnectionXmlToSlaveInstance
CheckConnectionXmlFromSlaveInstance
CheckConnectionXmlFromSoftwareInstance
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapWebServiceSlaveInstance))
return suite
...@@ -116,7 +116,8 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin): ...@@ -116,7 +116,8 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
SlapLogout""" SlapLogout"""
def stepInitializeTime(self, sequence=None): def stepInitializeTime(self, sequence=None):
sequence['start'] = DateTime() sequence['start'] = self.portal.portal_catalog(
sort_on=('uid', 'DESC'), limit=1)[0].uid
sequence['first_call'] = False sequence['first_call'] = False
sequence['second_call'] = False sequence['second_call'] = False
...@@ -197,7 +198,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin): ...@@ -197,7 +198,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
#We retrieve the Sale Packing List #We retrieve the Sale Packing List
sale_packing_list_list = sale_packing_list_module.searchFolder( sale_packing_list_list = sale_packing_list_module.searchFolder(
title='Resource consumptions', title='Resource consumptions',
creation_date={ uid={
'query' : sequence['start'], 'query' : sequence['start'],
'range' : 'min'}) 'range' : 'min'})
...@@ -235,7 +236,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin): ...@@ -235,7 +236,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
#We retrieve the Sale Invoice #We retrieve the Sale Invoice
sale_invoice_list = accounting_module.searchFolder( sale_invoice_list = accounting_module.searchFolder(
title='Resource consumptions', title='Resource consumptions',
creation_date={ uid={
'query' : sequence['start'], 'query' : sequence['start'],
'range' : 'min'}) 'range' : 'min'})
...@@ -283,7 +284,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin): ...@@ -283,7 +284,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
result_tuple = module_object.searchFolder( result_tuple = module_object.searchFolder(
title='Resource consumptions', title='Resource consumptions',
creation_date={ uid={
'query' : sequence['start'], 'query' : sequence['start'],
'range' : 'min'}) 'range' : 'min'})
...@@ -310,7 +311,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin): ...@@ -310,7 +311,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
# We retrieve computer # We retrieve computer
computer_id = sequence['computer_reference'] computer_id = sequence['computer_reference']
computer = self.getPortal().computer_module.searchFolder( computer = self.getPortal().computer_module.searchFolder(
title = computer_id)[0].getObject() reference = computer_id)[0].getObject()
for sale_invoice in sale_invoice_list: for sale_invoice in sale_invoice_list:
sale_invoice_line_list = \ sale_invoice_line_list = \
......
<h1 tal:replace="structure here/manage_page_header">Header</h1>
<h2 tal:define="form_title string:Add Vifib Shadow Authentication Plugin"
tal:replace="structure here/manage_form_title">Form Title</h2>
<p class="form-help">
Vifib Shadow Authentication Plugin allows to become shadows of Person and
Software Instances. The shadow is represented as Open Sale Order.
</p>
<form action="addVifibShadowAuthenticationPlugin" method="post">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
Id
</div>
</td>
<td align="left" valign="top">
<input type="text" name="id" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-optional">
Title
</div>
</td>
<td align="left" valign="top">
<input type="text" name="title" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<div class="form-element">
<input class="form-element" type="submit" name="submit"
value=" Add " />
</div>
</td>
</tr>
</table>
</form>
<h1 tal:replace="structure here/manage_page_footer">Footer</h1>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment