Commit aebb5950 authored by Łukasz Nowak's avatar Łukasz Nowak

Rebrand Vifib Machine plugin to SlapOS namespace.

parent d7f0a0b2
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SlapOSMachineAuthenticationPlugin" module="Products.SlapOS.SlapOSMachineAuthenticationPlugin"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_machine</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -8,7 +8,7 @@
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_checkPromiseVifibPAS</string> </value>
<value> <string>Alarm_checkPromiseSlapOSPAS</string> </value>
</item>
<item>
<key> <string>alarm_notification_mode</string> </key>
......@@ -30,7 +30,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>promise_vifib_pas</string> </value>
<value> <string>promise_slapos_pas</string> </value>
</item>
<item>
<key> <string>periodicity_day_frequency</string> </key>
......@@ -93,11 +93,11 @@
</item>
<item>
<key> <string>solve_method_id</string> </key>
<value> <string>Alarm_fixPromiseVifibPAS</string> </value>
<value> <string>Alarm_fixWithActiveSense</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Pluggable Auth Service Vifib Promise</string> </value>
<value> <string>Pluggable Auth Service SlapOS Promise</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -2,19 +2,23 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="VifibMachineAuthenticationPlugin" module="Products.Vifib.VifibMachineAuthenticationPlugin"/>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>vifib_machine_authentication</string> </value>
<value> <string>slapos_promise</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<none/>
</value>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -52,25 +52,22 @@
<key> <string>_body</string> </key>
<value> <string>promise_dict = {\n
\'IExtractionPlugin\': [\n
\'Vifib Machine Authentication Plugin\',\n
\'SlapOS Machine Authentication Plugin\',\n
],\n
\'IAuthenticationPlugin\': [\n
\'Vifib Machine Authentication Plugin\',\n
\'Vifib Shadow Authentication Plugin\',\n
\'SlapOS Machine Authentication Plugin\',\n
\'SlapOS Shadow Authentication Plugin\',\n
],\n
\'IGroupsPlugin\': [\n
\'Vifib Machine Authentication Plugin\',\n
\'Vifib Shadow Authentication Plugin\',\n
\'SlapOS Machine Authentication Plugin\',\n
\'SlapOS Shadow Authentication Plugin\',\n
],\n
\'IUserEnumerationPlugin\': [\n
\'Vifib Machine Authentication Plugin\',\n
\'Vifib Shadow Authentication Plugin\',\n
\'SlapOS Machine Authentication Plugin\',\n
\'SlapOS Shadow Authentication Plugin\',\n
]\n
}\n
context.Alarm_checkPromiseVifibPASBase(promise_dict, tag, fixit=fixit, **kw)\n
context.Alarm_checkPromiseSlapOSPASBase(promise_dict, tag, fixit=fixit, **kw)\n
</string> </value>
</item>
<item>
......@@ -79,7 +76,7 @@ context.Alarm_checkPromiseVifibPASBase(promise_dict, tag, fixit=fixit, **kw)\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_checkPromiseVifibPAS</string> </value>
<value> <string>Alarm_checkPromiseSlapOSPAS</string> </value>
</item>
</dictionary>
</pickle>
......
<?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.CMFActivity.ActiveResult import ActiveResult\n
\n
portal = context.getPortalObject()\n
def mergePASDictDifference(portal, d, fixit):\n
plugins = portal.acl_users.plugins\n
error_list = []\n
plugin_type_info = plugins.listPluginTypeInfo()\n
for plugin, active_list in d.iteritems():\n
plugin_info = [q for q in plugin_type_info if q[\'id\'] == plugin][0]\n
found_list = plugins.listPlugins(plugin_info[\'interface\'])\n
meta_type_list = [q[1].meta_type for q in found_list]\n
for expected in active_list:\n
if expected not in meta_type_list:\n
error = \'Plugin %s missing %s.\' % (plugin, expected)\n
if fixit: \n
existing = [q for q in portal.acl_users.objectValues() if q.meta_type == expected]\n
if len(existing) == 0:\n
error_list.append(\'%s not found\' % expected)\n
else:\n
plugins.activatePlugin(plugin_info[\'interface\'], existing[0].getId())\n
error += \' Fixed.\'\n
error_list.append(error)\n
\n
return error_list\n
\n
pas_difference = mergePASDictDifference(portal, promise_dict, fixit)\n
if len(pas_difference) != 0:\n
if fixit:\n
severity = 0\n
else:\n
severity = 1\n
summary = "PAS not configured as expected"\n
if fixit:\n
summary += \' (fixed)\'\n
detail = "Difference:\\n%s" % (\'\\n\'.join(pas_difference), )\n
else:\n
severity = 0\n
summary = "Nothing to do."\n
detail = ""\n
\n
active_result = ActiveResult()\n
active_result.edit(\n
summary=summary, \n
severity=severity,\n
detail=detail)\n
\n
context.newActiveProcess().postResult(active_result)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>promise_dict, tag, fixit=False, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_checkPromiseSlapOSPASBase</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -59,7 +59,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_fixPromiseVifibPAS</string> </value>
<value> <string>Alarm_fixWithActiveSense</string> </value>
</item>
</dictionary>
</pickle>
......
115
\ No newline at end of file
116
\ No newline at end of file
acl_users/slapos_machine
acl_users/slapos_shadow
computer_module/template_computer
computer_module/template_computer/**
hosting_subscription_module/template_hosting_subscription
person_module/template_member
person_module/template_member/**
portal_alarms/promise_slapos_pas
portal_alarms/slapos_allocate_instance
software_installation_module/template_software_installation
software_instance_module/template_software_instance
\ No newline at end of file
slapos_cloud
\ No newline at end of file
slapos_cloud
slapos_promise
\ No newline at end of file
109
\ No newline at end of file
110
\ No newline at end of file
......@@ -3,7 +3,6 @@ acl_users/erp5_google_extraction
acl_users/vifib_browser_id_authentication
acl_users/vifib_facebook_authentication
acl_users/vifib_google_authentication
acl_users/vifib_machine_authentication
currency_module/EUR
document_module/1
notification_message_module/vifib_hosting_hosting_request
......
527
\ No newline at end of file
528
\ No newline at end of file
......@@ -30,7 +30,7 @@
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo, getSecurityManager, Unauthorized
from Products.Vifib.VifibMachineAuthenticationPlugin import getUserByLogin
from Products.SlapOS.SlapOSMachineAuthenticationPlugin import getUserByLogin
from Products.ERP5Type import Permissions
from ComputedAttribute import ComputedAttribute
from zLOG import LOG, ERROR
......
23
\ No newline at end of file
24
\ No newline at end of file
......@@ -7,7 +7,7 @@
# 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
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
......@@ -51,21 +51,21 @@ from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
from Products.ERP5Security.ERP5UserManager import getValidAssignmentList
#Form for new plugin in ZMI
manage_addVifibMachineAuthenticationPluginForm = PageTemplateFile(
'www/Vifib_addVifibMachineAuthenticationPlugin', globals(),
__name__='manage_addVifibMachineAuthenticationPluginForm')
manage_addSlapOSMachineAuthenticationPluginForm = PageTemplateFile(
'www/SlapOS_addSlapOSMachineAuthenticationPlugin', globals(),
__name__='manage_addSlapOSMachineAuthenticationPluginForm')
def addVifibMachineAuthenticationPlugin(dispatcher, id, title=None, REQUEST=None):
""" Add a VifibMachineAuthenticationPlugin to a Pluggable Auth Service. """
def addSlapOSMachineAuthenticationPlugin(dispatcher, id, title=None, REQUEST=None):
""" Add a SlapOSMachineAuthenticationPlugin to a Pluggable Auth Service. """
plugin = VifibMachineAuthenticationPlugin(id, title)
plugin = SlapOSMachineAuthenticationPlugin(id, title)
dispatcher._setObject(plugin.getId(), plugin)
if REQUEST is not None:
REQUEST['RESPONSE'].redirect(
'%s/manage_workspace'
'?manage_tabs_message='
'VifibMachineAuthenticationPlugin+added.'
'SlapOSMachineAuthenticationPlugin+added.'
% dispatcher.absolute_url())
@transactional_cached(lambda portal, *args: args)
......@@ -101,12 +101,12 @@ def getUserByLogin(portal, login):
# by default (feature).
return [x.getObject() for x in result if x['reference'] in login]
class VifibMachineAuthenticationPlugin(BasePlugin):
class SlapOSMachineAuthenticationPlugin(BasePlugin):
"""
Plugin to authenicate as machines.
"""
meta_type = "Vifib Machine Authentication Plugin"
meta_type = "SlapOS Machine Authentication Plugin"
security = ClassSecurityInfo()
def __init__(self, id, title=None):
......@@ -174,7 +174,7 @@ class VifibMachineAuthenticationPlugin(BasePlugin):
except ConflictError:
raise
except:
LOG('VifibMachineAuthenticationPlugin', PROBLEM, 'getUserByLogin failed',
LOG('SlapOSMachineAuthenticationPlugin', PROBLEM, 'getUserByLogin failed',
error=sys.exc_info())
# Here we must raise an exception to prevent callers from caching
# a result of a degraded situation.
......@@ -346,17 +346,14 @@ class VifibMachineAuthenticationPlugin(BasePlugin):
return tuple(user_info)
#List implementation of class
classImplements(VifibMachineAuthenticationPlugin,
classImplements(SlapOSMachineAuthenticationPlugin,
plugins.IAuthenticationPlugin)
classImplements( VifibMachineAuthenticationPlugin,
plugins.ILoginPasswordHostExtractionPlugin
)
classImplements( VifibMachineAuthenticationPlugin,
plugins.IGroupsPlugin
)
classImplements( VifibMachineAuthenticationPlugin,
plugins.IUserEnumerationPlugin
)
InitializeClass(VifibMachineAuthenticationPlugin)
classImplements( SlapOSMachineAuthenticationPlugin,
plugins.ILoginPasswordHostExtractionPlugin)
classImplements( SlapOSMachineAuthenticationPlugin,
plugins.IGroupsPlugin)
classImplements( SlapOSMachineAuthenticationPlugin,
plugins.IUserEnumerationPlugin)
InitializeClass(SlapOSMachineAuthenticationPlugin)
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Vifib SA and Contributors. All Rights Reserved.
# Copyright (c) 2012 Nexedi 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
......@@ -38,6 +38,7 @@ content_constructors = ()
portal_tools = ()
from Products.PluggableAuthService.PluggableAuthService import registerMultiPlugin
import SlapOSMachineAuthenticationPlugin
import SlapOSShadowAuthenticationPlugin
def initialize(context):
......@@ -47,6 +48,14 @@ def initialize(context):
portal_tools=portal_tools, content_constructors=content_constructors,
content_classes=content_classes)
context.registerClass( SlapOSMachineAuthenticationPlugin.SlapOSMachineAuthenticationPlugin
, permission=ManageUsers
, constructors=(
SlapOSMachineAuthenticationPlugin.manage_addSlapOSMachineAuthenticationPluginForm,
SlapOSMachineAuthenticationPlugin.addSlapOSMachineAuthenticationPlugin, )
, visibility=None
, icon='www/portal.gif'
)
context.registerClass( SlapOSShadowAuthenticationPlugin.SlapOSShadowAuthenticationPlugin
, permission=ManageUsers
, constructors=(
......@@ -57,4 +66,5 @@ def initialize(context):
)
registerMultiPlugin(SlapOSMachineAuthenticationPlugin.SlapOSMachineAuthenticationPlugin.meta_type)
registerMultiPlugin(SlapOSShadowAuthenticationPlugin.SlapOSShadowAuthenticationPlugin.meta_type)
<h1 tal:replace="structure here/manage_page_header">Header</h1>
<h2 tal:define="form_title string:Add Vifib Machine Authentication Plugin"
<h2 tal:define="form_title string:Add SlapOS Machine Authentication Plugin"
tal:replace="structure here/manage_form_title">Form Title</h2>
<p class="form-help">
Vifib Machine Authentication Plugin allows to login machines (Computers and
SlapOS Machine Authentication Plugin allows to login machines (Computers and
Software Instances)
</p>
<form action="addVifibMachineAuthenticationPlugin" method="post">
<form action="addSlapOSMachineAuthenticationPlugin" method="post">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
......
......@@ -41,7 +41,6 @@ from Tool import SlapTool, VifibRestApiTool
portal_tools = ( SlapTool.SlapTool, VifibRestApiTool.VifibRestApiTool)
from Products.PluggableAuthService.PluggableAuthService import registerMultiPlugin
import VifibMachineAuthenticationPlugin
import VifibCookieHashExtractionPlugin
def initialize(context):
......@@ -51,15 +50,6 @@ def initialize(context):
portal_tools=portal_tools, content_constructors=content_constructors,
content_classes=content_classes)
context.registerClass( VifibMachineAuthenticationPlugin.VifibMachineAuthenticationPlugin
, permission=ManageUsers
, constructors=(
VifibMachineAuthenticationPlugin.manage_addVifibMachineAuthenticationPluginForm,
VifibMachineAuthenticationPlugin.addVifibMachineAuthenticationPlugin, )
, visibility=None
, icon='www/portal.gif'
)
context.registerClass( VifibCookieHashExtractionPlugin.VifibFacebookServerExtractionPlugin
, permission=ManageUsers
, constructors=(
......@@ -88,7 +78,6 @@ def initialize(context):
)
registerMultiPlugin(VifibMachineAuthenticationPlugin.VifibMachineAuthenticationPlugin.meta_type)
registerMultiPlugin(VifibCookieHashExtractionPlugin.VifibFacebookServerExtractionPlugin.meta_type)
registerMultiPlugin(VifibCookieHashExtractionPlugin.VifibGoogleServerExtractionPlugin.meta_type)
registerMultiPlugin(VifibCookieHashExtractionPlugin.VifibBrowserIDExtractionPlugin.meta_type)
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