Commit 132dd4a5 by Szabolcs Gelencser

Remove ACL model and arch field from instance and template

parent 8ea3fe0c
......@@ -2,19 +2,24 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="1fbec8af-5a7c-40f9-b994-83ac07d1ae1d" name="Default" comment="">
<change beforePath="" afterPath="$PROJECT_DIR$/circle/circle/os_policies/cinder_policy.json" />
<change beforePath="" afterPath="$PROJECT_DIR$/circle/circle/os_policies/glance_policy.json" />
<change beforePath="" afterPath="$PROJECT_DIR$/circle/circle/os_policies/keystone_policy.json" />
<change beforePath="" afterPath="$PROJECT_DIR$/circle/circle/os_policies/neutron_policy.json" />
<change beforePath="" afterPath="$PROJECT_DIR$/circle/circle/os_policies/nova_policy.json" />
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change beforePath="$PROJECT_DIR$/circle/acl/__init__.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/circle/acl/management/__init__.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/circle/acl/management/commands/__init__.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/circle/acl/management/commands/update_levels.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/circle/acl/migrations/0001_initial.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/circle/acl/migrations/__init__.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/circle/acl/models.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/circle/acl/tests/__init__.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/circle/acl/tests/models.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/circle/acl/tests/test_acl.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/circle/acl/views.py" afterPath="" />
<change beforePath="$PROJECT_DIR$/circle/circle/settings/base.py" afterPath="$PROJECT_DIR$/circle/circle/settings/base.py" />
<change beforePath="$PROJECT_DIR$/circle/common/operations.py" afterPath="$PROJECT_DIR$/circle/common/operations.py" />
<change beforePath="$PROJECT_DIR$/circle/dashboard/views/util.py" afterPath="$PROJECT_DIR$/circle/dashboard/views/util.py" />
<change beforePath="$PROJECT_DIR$/circle/dashboard/models.py" afterPath="$PROJECT_DIR$/circle/dashboard/models.py" />
<change beforePath="$PROJECT_DIR$/circle/dashboard/views/vm.py" afterPath="$PROJECT_DIR$/circle/dashboard/views/vm.py" />
<change beforePath="$PROJECT_DIR$/circle/vm/operations.py" afterPath="$PROJECT_DIR$/circle/vm/operations.py" />
<change beforePath="$PROJECT_DIR$/requirements/circlestack.txt" afterPath="$PROJECT_DIR$/requirements/circlestack.txt" />
<change beforePath="$PROJECT_DIR$/circle/firewall/models.py" afterPath="$PROJECT_DIR$/circle/firewall/models.py" />
<change beforePath="$PROJECT_DIR$/circle/vm/models/common.py" afterPath="$PROJECT_DIR$/circle/vm/models/common.py" />
<change beforePath="$PROJECT_DIR$/circle/vm/models/instance.py" afterPath="$PROJECT_DIR$/circle/vm/models/instance.py" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
......@@ -40,11 +45,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="operations.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/circle/vm/operations.py">
<file leaf-file-name="common.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/circle/vm/models/common.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="163">
<caret line="130" column="0" lean-forward="false" selection-start-line="130" selection-start-column="0" selection-end-line="130" selection-end-column="0" />
<state relative-caret-position="-816">
<caret line="29" column="41" lean-forward="true" selection-start-line="29" selection-start-column="41" selection-end-line="29" selection-end-column="41" />
<folding>
<element signature="e#732#788#0" expanded="true" />
</folding>
......@@ -52,22 +57,26 @@
</provider>
</entry>
</file>
<file leaf-file-name="util.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/circle/dashboard/views/util.py">
<file leaf-file-name="instance.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/circle/vm/models/instance.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="302">
<caret line="290" column="50" lean-forward="false" selection-start-line="290" selection-start-column="50" selection-end-line="290" selection-end-column="50" />
<folding />
<state relative-caret-position="182">
<caret line="212" column="11" lean-forward="false" selection-start-line="212" selection-start-column="11" selection-end-line="212" selection-end-column="11" />
<folding>
<element signature="e#732#788#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="nova_policy.json" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/circle/circle/os_policies/nova_policy.json">
<file leaf-file-name="models.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/circle/firewall/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="52" column="0" lean-forward="true" selection-start-line="52" selection-start-column="0" selection-end-line="52" selection-end-column="0" />
<folding />
<state relative-caret-position="182">
<caret line="357" column="48" lean-forward="false" selection-start-line="357" selection-start-column="48" selection-end-line="357" selection-end-column="48" />
<folding>
<element signature="e#757#789#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
......@@ -75,19 +84,21 @@
<file leaf-file-name="vm.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/circle/dashboard/views/vm.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="163">
<caret line="1270" column="61" lean-forward="false" selection-start-line="1270" selection-start-column="61" selection-end-line="1270" selection-end-column="61" />
<state relative-caret-position="476">
<caret line="141" column="39" lean-forward="true" selection-start-line="141" selection-start-column="39" selection-end-line="141" selection-end-column="39" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="operations.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/circle/common/operations.py">
<file leaf-file-name="models.py" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/circle/dashboard/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="426">
<caret line="74" column="41" lean-forward="false" selection-start-line="74" selection-start-column="41" selection-end-line="74" selection-end-column="41" />
<folding />
<state relative-caret-position="182">
<caret line="359" column="58" lean-forward="false" selection-start-line="359" selection-start-column="58" selection-end-line="359" selection-end-column="58" />
<folding>
<element signature="e#732#770#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
......@@ -104,9 +115,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>#TODO</find>
<find>get_sta</find>
<find>synch</find>
<find>instance</find>
<find>Instance</find>
<find>Instance(</find>
......@@ -134,6 +142,9 @@
<find>reboot</find>
<find>shutoff</find>
<find>destroyope</find>
<find>ACL_LEVELS</find>
<find>a</find>
<find>acl</find>
</findStrings>
<replaceStrings>
<replace>'ACTIVE'</replace>
......@@ -148,7 +159,6 @@
<option value="$PROJECT_DIR$/circle/static_collected/dashboard/dashboard.less" />
<option value="$PROJECT_DIR$/circle/vm/models/__init__.py" />
<option value="$PROJECT_DIR$/circle/dashboard/admin.py" />
<option value="$PROJECT_DIR$/circle/firewall/models.py" />
<option value="$PROJECT_DIR$/circle/request/models.py" />
<option value="$PROJECT_DIR$/circle/common/models.py" />
<option value="$PROJECT_DIR$/circle/openstack_auth/user_key.py" />
......@@ -157,7 +167,6 @@
<option value="$PROJECT_DIR$/circle/openstack_auth/plugin/password.py" />
<option value="$PROJECT_DIR$/circle/dashboard/views/user.py" />
<option value="$PROJECT_DIR$/circle/dashboard/templates/login.html" />
<option value="$PROJECT_DIR$/circle/dashboard/models.py" />
<option value="$PROJECT_DIR$/circle/dashboard/context_processors.py" />
<option value="$PROJECT_DIR$/circle/openstack_auth/user.py" />
<option value="$PROJECT_DIR$/circle/openstack_api/base.py" />
......@@ -167,7 +176,6 @@
<option value="$PROJECT_DIR$/circle/dashboard/templates/auth/login.html" />
<option value="$PROJECT_DIR$/circle/storage/models.py" />
<option value="$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html" />
<option value="$PROJECT_DIR$/circle/vm/models/common.py" />
<option value="$PROJECT_DIR$/circle/dashboard/templates/base.html" />
<option value="$PROJECT_DIR$/circle/dashboard/templates/dashboard/base.html" />
<option value="$PROJECT_DIR$/circle/dashboard/templates/dashboard/index.html" />
......@@ -183,17 +191,20 @@
<option value="$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail.html" />
<option value="$PROJECT_DIR$/circle/acl/models.py" />
<option value="$PROJECT_DIR$/circle/dashboard/urls.py" />
<option value="$PROJECT_DIR$/circle/vm/models/instance.py" />
<option value="$PROJECT_DIR$/circle/circle/os_policies/neutron_policy.json" />
<option value="$PROJECT_DIR$/circle/circle/os_policies/cinder_policy.json" />
<option value="$PROJECT_DIR$/circle/circle/os_policies/glance_policy.json" />
<option value="$PROJECT_DIR$/circle/circle/os_policies/keystone_policy.json" />
<option value="$PROJECT_DIR$/circle/openstack_auth/__init__.py" />
<option value="$PROJECT_DIR$/circle/circle/settings/base.py" />
<option value="$PROJECT_DIR$/circle/circle/os_policies/nova_policy.json" />
<option value="$PROJECT_DIR$/circle/vm/operations.py" />
<option value="$PROJECT_DIR$/circle/dashboard/views/util.py" />
<option value="$PROJECT_DIR$/circle/common/operations.py" />
<option value="$PROJECT_DIR$/circle/circle/settings/base.py" />
<option value="$PROJECT_DIR$/circle/vm/models/common.py" />
<option value="$PROJECT_DIR$/circle/vm/models/instance.py" />
<option value="$PROJECT_DIR$/circle/firewall/models.py" />
<option value="$PROJECT_DIR$/circle/dashboard/models.py" />
<option value="$PROJECT_DIR$/circle/dashboard/views/vm.py" />
</list>
</option>
......@@ -247,7 +258,7 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<expand>
......@@ -312,7 +323,7 @@
<select />
</subPane>
</pane>
<pane id="Scratches" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
......@@ -387,23 +398,23 @@
<layout>
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.327818" sideWeight="0.5021299" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32875264" sideWeight="0.4978701" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32875264" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.43023255" sideWeight="0.43610224" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32875264" sideWeight="0.4978701" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.43023255" sideWeight="0.43610224" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.157082" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.15867944" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32980973" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="SciView" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.43023255" sideWeight="0.5638978" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.43023255" sideWeight="0.5638978" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32980973" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
<layout-to-restore>
......@@ -560,27 +571,6 @@
</expressions>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/circle/dashboard/forms.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="181">
<caret line="983" column="6" lean-forward="false" selection-start-line="983" selection-start-column="6" selection-end-line="983" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file:///usr/lib/python2.7/threading.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="181">
<caret line="753" column="0" lean-forward="false" selection-start-line="753" selection-start-column="0" selection-end-line="753" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file:///usr/lib/python2.7/SocketServer.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="173">
<caret line="595" column="0" lean-forward="false" selection-start-line="595" selection-start-column="0" selection-end-line="595" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/core/servers/basehttp.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="181">
......@@ -636,7 +626,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="16898">
<caret line="1023" column="0" lean-forward="false" selection-start-line="1023" selection-start-column="0" selection-end-line="1023" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -644,7 +633,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="969">
<caret line="59" column="0" lean-forward="false" selection-start-line="59" selection-start-column="0" selection-end-line="59" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -660,7 +648,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="326">
<caret line="33" column="30" lean-forward="true" selection-start-line="33" selection-start-column="30" selection-end-line="33" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
......@@ -668,7 +655,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="190">
<caret line="518" column="4" lean-forward="false" selection-start-line="518" selection-start-column="4" selection-end-line="518" selection-end-column="4" />
<folding />
</state>
</provider>
</entry>
......@@ -684,7 +670,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="411">
<caret line="248" column="0" lean-forward="false" selection-start-line="248" selection-start-column="0" selection-end-line="248" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -708,7 +693,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="190">
<caret line="40" column="0" lean-forward="false" selection-start-line="40" selection-start-column="0" selection-end-line="40" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -716,7 +700,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="171">
<caret line="227" column="0" lean-forward="false" selection-start-line="227" selection-start-column="0" selection-end-line="227" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -724,7 +707,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="163">
<caret line="588" column="0" lean-forward="false" selection-start-line="588" selection-start-column="0" selection-end-line="588" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -732,7 +714,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="494">
<caret line="59" column="37" lean-forward="false" selection-start-line="59" selection-start-column="37" selection-end-line="59" selection-end-column="37" />
<folding />
</state>
</provider>
</entry>
......@@ -748,7 +729,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="455">
<caret line="234" column="1" lean-forward="false" selection-start-line="234" selection-start-column="1" selection-end-line="234" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
......@@ -756,7 +736,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="183">
<caret line="46" column="0" lean-forward="true" selection-start-line="46" selection-start-column="0" selection-end-line="46" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -764,7 +743,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="455">
<caret line="226" column="0" lean-forward="true" selection-start-line="226" selection-start-column="0" selection-end-line="226" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -772,7 +750,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -784,14 +761,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/dashboard/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="185">
<caret line="129" column="26" lean-forward="false" selection-start-line="129" selection-start-column="17" selection-end-line="129" selection-end-column="26" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/acl/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-515">
......@@ -800,14 +769,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/vm/models/instance.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="520">
<caret line="392" column="35" lean-forward="true" selection-start-line="392" selection-start-column="35" selection-end-line="392" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
<entry file="file:///usr/lib/python2.7/collections.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="171">
......@@ -820,7 +781,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="590">
<caret line="226" column="22" lean-forward="true" selection-start-line="226" selection-start-column="22" selection-end-line="226" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
......@@ -836,15 +796,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="171">
<caret line="246" column="0" lean-forward="false" selection-start-line="246" selection-start-column="0" selection-end-line="246" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/db/models/base.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="171">
<caret line="109" column="0" lean-forward="false" selection-start-line="109" selection-start-column="0" selection-end-line="109" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -869,7 +820,7 @@
<state relative-caret-position="182">
<caret line="137" column="17" lean-forward="false" selection-start-line="137" selection-start-column="17" selection-end-line="137" selection-end-column="17" />
<folding>
<element signature="e#546#561#0" expanded="true" />
<element signature="e#546#561#0" expanded="false" />
</folding>
</state>
</provider>
......@@ -886,7 +837,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2754">
<caret line="162" column="1" lean-forward="false" selection-start-line="162" selection-start-column="1" selection-end-line="162" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
......@@ -894,17 +844,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="171">
<caret line="118" column="0" lean-forward="false" selection-start-line="118" selection-start-column="0" selection-end-line="118" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/circle/settings/base.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="173">
<caret line="537" column="41" lean-forward="false" selection-start-line="537" selection-start-column="41" selection-end-line="537" selection-end-column="41" />
<folding>
<element signature="e#782#791#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
......@@ -912,7 +851,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="163">
<caret line="540" column="0" lean-forward="false" selection-start-line="540" selection-start-column="0" selection-end-line="540" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
......@@ -920,30 +858,43 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="299">
<caret line="156" column="0" lean-forward="false" selection-start-line="156" selection-start-column="0" selection-end-line="156" selection-end-column="0" />
<folding>
<element signature="e#615#629#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/vm/operations.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="163">
<state relative-caret-position="0">
<caret line="130" column="0" lean-forward="false" selection-start-line="130" selection-start-column="0" selection-end-line="130" selection-end-column="0" />
<folding>
<element signature="e#732#788#0" expanded="true" />
<element signature="e#732#788#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/dashboard/views/util.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="302">
<state relative-caret-position="4437">
<caret line="290" column="50" lean-forward="false" selection-start-line="290" selection-start-column="50" selection-end-line="290" selection-end-column="50" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/circle/os_policies/nova_policy.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="884">
<caret line="52" column="0" lean-forward="false" selection-start-line="52" selection-start-column="0" selection-end-line="52" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/acl/management/commands/update_levels.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/common/operations.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="426">
......@@ -952,18 +903,66 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/circle/os_policies/nova_policy.json">
<entry file="file://$PROJECT_DIR$/circle/circle/settings/base.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="318">
<caret line="370" column="0" lean-forward="false" selection-start-line="370" selection-start-column="0" selection-end-line="370" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/db/models/base.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="52" column="0" lean-forward="true" selection-start-line="52" selection-start-column="0" selection-end-line="52" selection-end-column="0" />
<state relative-caret-position="306">
<caret line="470" column="6" lean-forward="false" selection-start-line="470" selection-start-column="6" selection-end-line="470" selection-end-column="6" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/vm/models/common.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-816">
<caret line="29" column="41" lean-forward="true" selection-start-line="29" selection-start-column="41" selection-end-line="29" selection-end-column="41" />
<folding>
<element signature="e#732#788#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/vm/models/instance.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="182">
<caret line="212" column="11" lean-forward="false" selection-start-line="212" selection-start-column="11" selection-end-line="212" selection-end-column="11" />
<folding>
<element signature="e#732#788#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/firewall/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="182">
<caret line="357" column="48" lean-forward="false" selection-start-line="357" selection-start-column="48" selection-end-line="357" selection-end-column="48" />
<folding>
<element signature="e#757#789#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/dashboard/models.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="182">
<caret line="359" column="58" lean-forward="false" selection-start-line="359" selection-start-column="58" selection-end-line="359" selection-end-column="58" />
<folding>
<element signature="e#732#770#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/circle/dashboard/views/vm.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="163">
<caret line="1270" column="61" lean-forward="false" selection-start-line="1270" selection-start-column="61" selection-end-line="1270" selection-end-column="61" />
<state relative-caret-position="476">
<caret line="141" column="39" lean-forward="true" selection-start-line="141" selection-start-column="39" selection-end-line="141" selection-end-column="39" />
<folding />
</state>
</provider>
......
"""
Creates Levels for all installed apps that have levels.
"""
from django.db.models import signals
from django.apps import apps
from django.db import DEFAULT_DB_ALIAS
from django.core.exceptions import ImproperlyConfigured
from ..models import Level, AclBase
def create_levels(app_config, verbosity=False, using=DEFAULT_DB_ALIAS,
**kwargs):
"""Create and set the weights of the configured Levels.
Based on django.contrib.auth.management.__init__.create_permissions"""
# if not router.allow_migrate(using, auth_app.Permission):
# return
from django.contrib.contenttypes.models import ContentType
app_models = [k for k in apps.get_models(app_config)
if AclBase in k.__bases__]
print "Creating levels for models: %s." % ", ".join(
[m.__name__ for m in app_models])
# This will hold the levels we're looking for as
# (content_type, (codename, name))
searched_levels = list()
level_weights = list()
# The codenames and ctypes that should exist.
ctypes = set()
for klass in app_models:
# Force looking up the content types in the current database
# before creating foreign keys to them.
ctype1 = ContentType.objects.db_manager(using).get_for_model(klass)
ctypes.add(ctype1)
weight = 0
try:
for codename, name in klass.ACL_LEVELS:
searched_levels.append((ctype1, (codename, name)))
level_weights.append((ctype1, codename, weight))
weight += 1
except AttributeError:
raise ImproperlyConfigured(
"Class %s doesn't have ACL_LEVELS attribute." % klass)
# Find all the Levels that have a content_type for a model we're
# looking for. We don't need to check for codenames since we already have
# a list of the ones we're going to create.
all_levels = set(Level.objects.using(using).filter(
content_type__in=ctypes,
).values_list(
"content_type", "codename"
))
levels = [
Level(codename=codename, name=name, content_type=ctype)
for ctype, (codename, name) in searched_levels
if (ctype.pk, codename) not in all_levels
]
Level.objects.using(using).bulk_create(levels)
if verbosity >= 2:
print("Adding levels [%s]." % ", ".join(unicode(l) for l in levels))
print("Searched: [%s]." % ", ".join(
unicode(l) for l in searched_levels))
print("All: [%s]." % ", ".join(unicode(l) for l in all_levels))
# set weights
for ctype, codename, weight in level_weights:
Level.objects.filter(codename=codename,
content_type=ctype).update(weight=weight)
signals.post_migrate.connect(
create_levels, dispatch_uid="circle.acl.management.create_levels")
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE 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 3 of the License, or (at your option)
# any later version.
#
# CIRCLE 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 CIRCLE. If not, see <http://www.gnu.org/licenses/>.
from django.core.management.base import BaseCommand
from .. import create_levels
class Command(BaseCommand):
args = ''
help = 'Regenerates Levels'
def handle(self, *args, **options):
create_levels(None, None, 3)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Level',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=50, verbose_name=b'name')),
('codename', models.CharField(max_length=100, verbose_name=b'codename')),
('weight', models.IntegerField(null=True, verbose_name=b'weight')),
('content_type', models.ForeignKey(to='contenttypes.ContentType')),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ObjectLevel',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('object_id', models.IntegerField()),
('content_type', models.ForeignKey(to='contenttypes.ContentType')),
('groups', models.ManyToManyField(to='auth.Group')),
('level', models.ForeignKey(to='acl.Level')),
('users', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
],
options={
},
bases=(models.Model,),
),
migrations.AlterUniqueTogether(
name='objectlevel',
unique_together=set([('content_type', 'object_id', 'level')]),
),
migrations.AlterUniqueTogether(
name='level',
unique_together=set([('content_type', 'codename')]),
),
]
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE 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 3 of the License, or (at your option)
# any later version.
#
# CIRCLE 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 CIRCLE. If not, see <http://www.gnu.org/licenses/>.
import logging
from django.contrib.auth.models import Group
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation
)
from django.contrib.contenttypes.models import ContentType
from django.db.models import (
ManyToManyField, ForeignKey, CharField, Model, IntegerField, Q
)
from openstack_auth.user import User
logger = logging.getLogger(__name__)
class Level(Model):
"""Definition of a permission level.
Instances are automatically populated based on AclBase."""
name = CharField('name', max_length=50)
content_type = ForeignKey(ContentType)
codename = CharField('codename', max_length=100)
weight = IntegerField('weight', null=True)
def __unicode__(self):
return "<%s/%s>" % (unicode(self.content_type), self.name)
class Meta:
app_label = 'acl'
unique_together = (('content_type', 'codename'),
# ('content_type', 'weight'),
# TODO find a way of temp. disabling this constr.
)
class ObjectLevel(Model):
"""Permission level for a specific object."""
level = ForeignKey(Level)
content_type = ForeignKey(ContentType)
object_id = IntegerField()
content_object = GenericForeignKey()
users = ManyToManyField(User)
groups = ManyToManyField(Group)
def __unicode__(self):
return "<%s: %s>" % (unicode(self.content_object), unicode(self.level))
class Meta:
app_label = 'acl'
unique_together = (('content_type', 'object_id', 'level'),)
class AclBase(Model):
"""Define permission levels for Users/Groups per object."""
object_level_set = GenericRelation(ObjectLevel)
def clone_acl(self, other):
pass
@classmethod
def get_level_object(cls, level):
ct = ContentType.objects.get_for_model(cls)
return Level.objects.get(codename=level, content_type=ct)
def set_level(self, whom, level):
"""Set level of object for a user or group.
:param whom: user or group the level is set for
:type whom: User or Group
:param level: codename of level to set, or None
:type level: Level or str or unicode or NoneType
"""
if isinstance(whom, User):
self.set_user_level(whom, level)
elif isinstance(whom, Group):
self.set_group_level(whom, level)
else:
raise AttributeError('"whom" must be a User or Group object.')
def set_user_level(self, user, level):
#TODO: delete
pass
def set_group_level(self, group, level):
#TODO: delete
pass
def has_level(self, user, level, group_also=True):
#TODO: implement
logger.debug('%s.has_level(%s, %s, %s) called',
*[unicode(p) for p in [self, user, level, group_also]])
return True
def get_users_with_level(self, **kwargs):
# TODO: implement
logger.debug('%s.get_users_with_level() called', unicode(self))
return []
def get_groups_with_level(self):
# TODO: implement
logger.debug('%s.get_groups_with_level() called', unicode(self))
return []
@classmethod
def get_objects_with_level(cls, level, user,
group_also=True, owner_also=False,
disregard_superuser=False):
logger.debug('%s.get_objects_with_level(%s,%s) called',
unicode(cls), unicode(level), unicode(user))
if user is None or not user.is_authenticated():
return cls.objects.none()
if getattr(user, 'is_superuser', False) and not disregard_superuser:
logger.debug('- superuser granted')
return cls.objects.all()
if isinstance(level, basestring):
level = cls.get_level_object(level)
logger.debug("- level set by str: %s", unicode(level))
ct = ContentType.objects.get_for_model(cls)
levelfilter = Q(users=user)
if group_also:
levelfilter |= Q(groups__in=user.groups.all())
ols = ObjectLevel.objects.filter(
levelfilter,
content_type=ct, level__weight__gte=level.weight).distinct()
clsfilter = Q(object_level_set__in=ols.all())
if owner_also:
clsfilter |= Q(owner=user)
return cls.objects.filter(clsfilter).distinct()
@classmethod
def get_objects_with_group_level(cls, level, group):
if isinstance(level, basestring):
level = cls.get_level_object(level)
ct = ContentType.objects.get_for_model(cls)
levelfilter = Q(groups=group)
ols = ObjectLevel.objects.filter(
levelfilter,
content_type=ct, level__weight__gte=level.weight).distinct()
clsfilter = Q(object_level_set__in=ols.all())
return cls.objects.filter(clsfilter).distinct()
def save(self, *args, **kwargs):
super(AclBase, self).save(*args, **kwargs)
if 'owner' in dict(self.ACL_LEVELS) and (hasattr(self, 'owner') and
self.owner):
self.set_user_level(self.owner, 'owner')
class Meta:
abstract = True
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE 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 3 of the License, or (at your option)
# any later version.
#
# CIRCLE 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 CIRCLE. If not, see <http://www.gnu.org/licenses/>.
from django.conf import settings
# https://code.djangoproject.com/ticket/7835
if settings.SETTINGS_MODULE == 'circle.settings.test':
from .test_acl import TestModel, Test2Model # noqa
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE 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 3 of the License, or (at your option)
# any later version.
#
# CIRCLE 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 CIRCLE. If not, see <http://www.gnu.org/licenses/>.
from django.test import TestCase
from django.contrib.auth.models import User, Group, AnonymousUser
from django.db.models import TextField, ForeignKey
from ..models import ObjectLevel, AclBase
class TestModel(AclBase):
normal_field = TextField()
ACL_LEVELS = (
('alfa', 'Alfa'),
('bravo', 'Bravo'),
('charlie', 'Charlie'),
)
class Test2Model(AclBase):
normal2_field = TextField()
owner = ForeignKey(User, null=True)
ACL_LEVELS = (
('one', 'One'),
('two', 'Two'),
('three', 'Three'),
('owner', 'owner'),
)
class AclUserTest(TestCase):
def setUp(self):
self.u1 = User.objects.create(username='user1')
self.u2 = User.objects.create(username='user2', is_staff=True)
self.us = User.objects.create(username='superuser', is_superuser=True)
self.g1 = Group.objects.create(name='group1')
self.g1.user_set.add(self.u1)
self.g1.user_set.add(self.u2)
self.g1.save()
self.g2 = Group.objects.create(name='group2')
self.g2.save()
def test_level_exists(self):
for codename, name in TestModel.ACL_LEVELS:
level = TestModel.get_level_object(codename)
self.assertEqual(level.codename, codename)
for codename, name in Test2Model.ACL_LEVELS:
level = Test2Model.get_level_object(codename)
self.assertEqual(level.codename, codename)
def test_lowest_user_level(self):
i = TestModel.objects.create(normal_field='Hello')
self.assertFalse(i.has_level(self.u1, 'alfa', False))
self.assertFalse(i.has_level(self.u1, 'bravo', False))
i.set_level(self.u1, 'alfa')
i.set_level(self.g1, 'bravo')
self.assertTrue(i.has_level(self.u1, 'alfa', False))
self.assertFalse(i.has_level(self.u1, 'bravo', False))
def test_anonymous_user_level(self):
i = TestModel.objects.create(normal_field='Hello')
anon = AnonymousUser()
self.assertFalse(i.has_level(anon, 'alfa'))
self.assertFalse(i.has_level(anon, 'bravo'))
def test_middle_user_level(self):
i = TestModel.objects.create(normal_field='Hello')
self.assertFalse(i.has_level(self.u1, 'alfa'))
self.assertFalse(i.has_level(self.u1, 'bravo'))
self.assertFalse(i.has_level(self.u1, 'charlie'))
i.set_level(self.u1, 'bravo')
self.assertTrue(i.has_level(self.u1, 'alfa'))
self.assertTrue(i.has_level(self.u1, 'bravo'))
self.assertFalse(i.has_level(self.u1, 'charlie'))
def test_level_set_twice_same(self):
i = TestModel.objects.create(normal_field='Hello')
self.assertFalse(i.has_level(self.u1, 'alfa'))
self.assertFalse(i.has_level(self.u1, 'bravo'))
self.assertFalse(i.has_level(self.u1, 'charlie'))
i.set_level(self.u1, 'bravo')
i.set_level(self.u1, 'bravo')
self.assertTrue(i.has_level(self.u1, 'alfa'))
self.assertTrue(i.has_level(self.u1, 'bravo'))
self.assertFalse(i.has_level(self.u1, 'charlie'))
def test_level_set_twice_different(self):
i = TestModel.objects.create(normal_field='Hello')
self.assertFalse(i.has_level(self.u1, 'alfa'))
self.assertFalse(i.has_level(self.u1, 'bravo'))
self.assertFalse(i.has_level(self.u1, 'charlie'))
i.set_level(self.u1, 'charlie')
i.set_level(self.u1, 'bravo')
self.assertTrue(i.has_level(self.u1, 'alfa'))
self.assertTrue(i.has_level(self.u1, 'bravo'))
self.assertFalse(i.has_level(self.u1, 'charlie'))
def test_superuser(self):
i = TestModel.objects.create(normal_field='Hello')
for u, v in [(self.u1, False), (self.u2, False), (self.us, True)]:
self.assertEqual(i.has_level(u, 'alfa'), v)
self.assertEqual(i.has_level(u, 'bravo'), v)
self.assertEqual(i.has_level(u, 'charlie'), v)
def test_check_group_membership(self):
groups = self.u1.groups.values_list('id', flat=True)
self.assertIn(self.g1.id, groups)
self.assertTrue(self.g1.user_set.filter(id=self.u2.id).exists())
def test_lowest_group_level(self):
i = TestModel.objects.create(normal_field='Hello')
self.assertFalse(i.has_level(self.u1, 'alfa'))
self.assertFalse(i.has_level(self.u1, 'bravo'))
i.set_level(self.g1, 'alfa')
self.assertTrue(i.has_level(self.u1, 'alfa'))
self.assertFalse(i.has_level(self.u1, 'bravo'))
def test_middle_group_level(self):
i = TestModel.objects.create(normal_field='Hello')
self.assertFalse(i.has_level(self.u1, 'alfa'))
self.assertFalse(i.has_level(self.u1, 'bravo'))
self.assertFalse(i.has_level(self.u1, 'charlie'))
i.set_level(self.g1, 'bravo')
self.assertTrue(i.has_level(self.u1, 'alfa'))
self.assertTrue(i.has_level(self.u1, 'bravo'))
self.assertFalse(i.has_level(self.u1, 'charlie'))
def test_set_level_error_handling(self):
with self.assertRaises(AttributeError):
TestModel.objects.create().set_level('wrong arg', 'level')
def test_get_users_with_level(self):
i1 = TestModel.objects.create(normal_field='Hello')
i2 = Test2Model.objects.create(normal2_field='Hello2')
i1.set_level(self.u1, 'bravo')
i1.set_level(self.u2, 'charlie')
i2.set_level(self.u1, 'one')
i2.set_level(self.us, u'three')
res1 = i1.get_users_with_level()
self.assertEqual([(self.u1, u'bravo'), (self.u2, u'charlie')], res1)
res2 = i2.get_users_with_level()
self.assertEqual([(self.u1, u'one'), (self.us, u'three')], res2)
def test_get_groups_with_level(self):
i1 = TestModel.objects.create(normal_field='Hello')
i2 = Test2Model.objects.create(normal2_field='Hello2')
i1.set_level(self.g1, 'bravo')
i1.set_level(self.u2, 'charlie')
i2.set_level(self.g1, 'one')
i2.set_level(self.us, u'three')
res1 = i1.get_groups_with_level()
self.assertEqual([(self.g1, u'bravo')], res1)
res2 = i2.get_groups_with_level()
self.assertEqual([(self.g1, u'one')], res2)
def test_object_level_unicode(self):
i1 = TestModel.objects.create(normal_field='Hello')
i1.set_level(self.g1, 'bravo')
unicode(ObjectLevel.objects.all()[0])
def test_set_user_level_none(self):
i = TestModel.objects.create(normal_field='Hello')
i.set_level(self.u1, 'alfa')
self.assertTrue(i.has_level(self.u1, 'alfa'))
i.set_level(self.u1, None)
self.assertFalse(i.has_level(self.u1, 'alfa'))
def test_set_group_level_none(self):
i = TestModel.objects.create(normal_field='Hello')
i.set_level(self.g1, 'alfa')
self.assertTrue(i.has_level(self.u1, 'alfa'))
i.set_level(self.g1, None)
self.assertFalse(i.has_level(self.u1, 'alfa'))
def test_get_objects_with_level(self):
i1 = TestModel.objects.create(normal_field='Hello1')
i2 = TestModel.objects.create(normal_field='Hello2')
i1.set_level(self.u1, 'alfa')
i2.set_level(self.u1, 'bravo')
i2.set_level(self.u2, 'bravo')
self.assertItemsEqual(
TestModel.get_objects_with_level('alfa', self.u1), [i1, i2])
self.assertItemsEqual(
TestModel.get_objects_with_level('alfa', self.u2), [i2])
def test_get_objects_with_level_for_superuser(self):
i1 = TestModel.objects.create(normal_field='Hello1')
i2 = TestModel.objects.create(normal_field='Hello2')
i1.set_level(self.u1, 'alfa')
i2.set_level(self.us, 'alfa')
self.assertItemsEqual(
TestModel.get_objects_with_level('alfa', self.u1), [i1])
self.assertItemsEqual(
TestModel.get_objects_with_level('alfa', self.us), [i1, i2])
self.assertItemsEqual(
TestModel.get_objects_with_level('alfa', self.us,
disregard_superuser=True), [i2])
def test_get_objects_with_level_for_group(self):
i1 = TestModel.objects.create(normal_field='Hello1')
i2 = TestModel.objects.create(normal_field='Hello2')
i1.set_level(self.g1, 'alfa')
i2.set_level(self.g1, 'bravo')
i2.set_level(self.u1, 'bravo')
self.assertItemsEqual(
TestModel.get_objects_with_level('alfa', self.u1), [i1, i2])
def test_get_objects_with_group_level(self):
i1 = TestModel.objects.create(normal_field='Hello1')
i2 = TestModel.objects.create(normal_field='Hello2')
i1.set_level(self.g1, 'alfa')
i2.set_level(self.g1, 'bravo')
i2.set_level(self.g2, 'bravo')
self.assertItemsEqual(
TestModel.get_objects_with_group_level('alfa', self.g1), [i1, i2])
self.assertItemsEqual(
TestModel.get_objects_with_group_level('alfa', self.g2), [i2])
def test_owner(self):
i = Test2Model.objects.create(normal2_field='Hello',
owner=self.u1)
self.assertTrue(i.has_level(self.u1, 'one'))
self.assertTrue(i.has_level(self.u1, 'owner'))
self.assertFalse(i.has_level(self.u2, 'owner'))
def test_owner_change(self):
i = Test2Model.objects.create(normal2_field='Hello',
owner=self.u1)
self.assertTrue(i.has_level(self.u1, 'one'))
self.assertTrue(i.has_level(self.u1, 'owner'))
self.assertFalse(i.has_level(self.u2, 'owner'))
i.owner = self.u2
i.save()
self.assertTrue(i.has_level(self.u1, 'one'))
self.assertTrue(i.has_level(self.u1, 'owner'))
self.assertTrue(i.has_level(self.u2, 'owner'))
def test_owner_change_from_none(self):
i = Test2Model.objects.create(normal2_field='Hello')
self.assertFalse(i.has_level(self.u1, 'one'))
self.assertFalse(i.has_level(self.u1, 'owner'))
self.assertFalse(i.has_level(self.u2, 'owner'))
i.owner = self.u2
i.save()
self.assertFalse(i.has_level(self.u1, 'one'))
self.assertFalse(i.has_level(self.u1, 'owner'))
self.assertTrue(i.has_level(self.u2, 'owner'))
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE 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 3 of the License, or (at your option)
# any later version.
#
# CIRCLE 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 CIRCLE. If not, see <http://www.gnu.org/licenses/>.
# Create your views here.
No preview for this file type
......@@ -368,7 +368,6 @@ LOCAL_APPS = (
'network',
'dashboard',
'manager',
'acl',
'monitor',
'request',
'openstack_auth',
......
......@@ -44,7 +44,6 @@ from model_utils.models import TimeFramedModel, TimeStampedModel
from model_utils.fields import StatusField
from model_utils import Choices
from acl.models import AclBase
from common.models import HumanReadableObject, create_readable, Encoder
from vm.models.instance import ACCESS_METHODS
......@@ -283,12 +282,7 @@ class FutureMember(Model):
return u"%s (%s)" % (self.org_id, self.group)
class GroupProfile(AclBase):
ACL_LEVELS = (
('operator', _('operator')),
('owner', _('owner')),
)
class GroupProfile(Model):
group = OneToOneField(Group)
org_id = CharField(
unique=True, blank=True, null=True, max_length=64,
......
......@@ -138,15 +138,12 @@ class VmDetailView(LoginRequiredMixin, GraphMixin, DetailView):
activities = openstack_api.nova.instance_action_list(self.request, instance.os_server_id)
context['vlans'] = Vlan.get_objects_with_level(
'user', self.request.user
).exclude( # exclude already added interfaces
pk__in=Interface.objects.filter(
instance=self.get_object()).values_list("vlan", flat=True)
).all()
# context['acl'] = AclUpdateView.get_acl_data(
# instance, self.request.user, 'dashboard.views.vm-acl')
context['aclform'] = AclUserOrGroupAddForm()
# context['vlans'] = Vlan.get_objects_with_level(
# 'user', self.request.user
# ).exclude( # exclude already added interfaces
# pk__in=Interface.objects.filter(
# instance=self.get_object()).values_list("vlan", flat=True)
# ).all()
context['os_type_icon'] = instance.os_type.replace("unknown",
"question")
# ipv6 infos
......
......@@ -42,7 +42,6 @@ from common.models import method_cache, WorkerNotFound, HumanSortField
from firewall.tasks.local_tasks import reloadtask
from firewall.tasks.remote_tasks import get_dhcp_clients
from .iptables import IptRule
from acl.models import AclBase
from openstack_auth.user import User
......@@ -272,7 +271,7 @@ class Rule(models.Model):
)
class Vlan(AclBase, models.Model):
class Vlan(models.Model):
"""
A vlan of the network,
......@@ -284,11 +283,6 @@ class Vlan(AclBase, models.Model):
Each vlan network has a unique identifier, a name, a unique IPv4 and IPv6
range. The gateway also has an IP address in each range.
"""
ACL_LEVELS = (
('user', _('user')),
('operator', _('operator')),
)
CHOICES_NETWORK_TYPE = (('public', _('public')),
('portforward', _('portforward')))
vid = models.IntegerField(unique=True,
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-02-26 11:39
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('vm', '0006_remove_instance_name'),
]
operations = [
migrations.RemoveField(
model_name='instancetemplate',
name='arch',
),
migrations.RemoveField(
model_name='namedbaseresourceconfig',
name='arch',
),
]
......@@ -25,13 +25,6 @@ from django.utils.timesince import timeuntil
from model_utils.models import TimeStampedModel
from acl.models import AclBase
ARCHITECTURES = (('x86_64', 'x86-64 (64 bit)'),
('i686', 'x86 (32 bit)'))
class BaseResourceConfigModel(Model):
"""Abstract base for models with base resource configuration parameters.
......@@ -47,8 +40,6 @@ class BaseResourceConfigModel(Model):
help_text=_('Upper memory size limit '
'for balloning.'),
validators=[MinValueValidator(0)])
arch = CharField(max_length=10, verbose_name=_('architecture'),
choices=ARCHITECTURES)
priority = IntegerField(verbose_name=_('priority'),
help_text=_('CPU priority.'),
validators=[MinValueValidator(0)])
......@@ -73,18 +64,13 @@ class NamedBaseResourceConfig(BaseResourceConfigModel, TimeStampedModel):
return self.name
class Lease(AclBase):
class Lease(Model):
"""Lease times for VM instances.
Specifies a time duration until suspension and deletion of a VM
instance.
"""
ACL_LEVELS = (
('user', _('user')), # use this lease
('operator', _('operator')), # share this lease
('owner', _('owner')), # change this lease
)
name = CharField(max_length=100, unique=True,
verbose_name=_('name'))
suspend_interval_seconds = IntegerField(
......
......@@ -41,7 +41,6 @@ from model_utils.models import TimeStampedModel, StatusModel
from openstack_api.nova import Server
from taggit.managers import TaggableManager
from acl.models import AclBase
from common.models import (
activitycontextimpl, create_readable, HumanReadableException,
)
......@@ -125,15 +124,10 @@ class VirtualMachineDescModel(BaseResourceConfigModel):
abstract = True
class InstanceTemplate(AclBase, VirtualMachineDescModel, TimeStampedModel):
class InstanceTemplate(VirtualMachineDescModel, TimeStampedModel):
"""Virtual machine template.
"""
ACL_LEVELS = (
('user', _('user')), # see all details
('operator', _('operator')),
('owner', _('owner')), # superuser, can delete, delegate perms
)
name = CharField(max_length=100, verbose_name=_('name'),
help_text=_('Human readable name of template.'))
description = TextField(verbose_name=_('description'), blank=True)
......@@ -213,11 +207,6 @@ class Instance(OperatedMixin, TimeStampedModel):
"""Virtual machine instance.
"""
ACL_LEVELS = (
('user', _('user')), # see all details
('operator', _('operator')), # console, networking, change state
('owner', _('owner')), # superuser, can delete, delegate perms
)
STATUS = Choices(
('PAUSED', _('paused')),
('SUSPENDED', _('suspended')),
......
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 sign in to comment