Package: cone.ugm
Plugin forcone.appproviding a
user and group management UI.FeaturesUsers and Groups CRUDPrincipal membership of users and groupsRoles supportLocal Manager SupportUser and group form configurationSetupPrerequirementsWhile installationlxmlgets compiled, the required dev headers must be
installed on the system.On debian based systems install:$apt-getinstall-ylibxml2-devlibxslt1-devDevelopment and TestingFor testing and development,cone.ugmcontains a buildout configuration.
Download or checkout package and run:cone.ugm$./bootstrap.shpython3Example ConfigurationFor testing and demo purposes, an example UGM configuration is contained in thecfgfolder of the source package.It contains the configuration fileugm.xml, containing the general UGM
configuration andlocalmanager.xml, containing the configuration about
local users and groups management. These two files can be edited TTW via the
settings UI.Theugm.inifile contains the application configuration:[app:ugm]...cone.plugins=cone.ugmugm.backend=fileugm.config=%(here)s/ugm.xmlugm.localmanager_config=%(here)s/localmanager.xmlugm.users_file=%(here)s/../parts/ugm/usersugm.groups_file=%(here)s/../parts/ugm/groupsugm.roles_file=%(here)s/../parts/ugm/rolesugm.datadir=%(here)s/../parts/ugm/data...In this example thefilebackend is configured as UGM backend. For
configuring SQL or LDAP based backends, see documentation atcone.sqlrespectivecone.ldap.Start the application:cone.ugm$./bin/pservercfg/ugm.iniand browsehttp://localhost:8081/. Defaultadminuser password isadmin.Configuration and CustomizationGeneralFor customizing the plugin, make an integration package and include it in
your setup.Rolescone.ugminternally uses 3 roles in order to permit user actions.editoris permitted to manage membership,adminadditionally is
permitted to add, edit and delete users and groups, andmanageris a
superuser. If UGM is the only plugin used, you can reduce the available roles
to this three:cone.app.security.DEFAULT_ROLES=[('editor','Editor'),('admin','Admin'),('manager','Manager')]Principal FormsThe basic principal form customization happens in the ugm XML configuration
file. Each field to render must have an entry inusers_form_attrmaprespectivegroups_form_attrmap:<users_form_attrmap><elem><key>my_field</key><value>MyField</value></elem></users_form_attrmap>By default, a non required text field gets rendered for each custom entry in
the XML configuration.To make a custom field required, the easiest way is to usedefault_form_field_factoryand register it withuser_fieldrespectivegroup_field:fromcone.ugm.browser.principalimportdefault_form_field_factoryfromcone.ugm.browser.principalimportuser_fieldfromfunctoolsimportpartialmy_field_factory=user_field('my_field')(partial(default_form_field_factory,required=True))It’s possible to register custom principal field factories for dedicated
UGM backends. This example is taken fromcone.ldapand registers a
user field factory forcnattribute inldapbackend:ldap_cn_field_factory=user_field('cn',backend='ldap')(partial(default_form_field_factory,required=True))The most flexible way for principal form field customization is to provide
a callback function and call the yafowil factory directly:fromyafowil.baseimportfactory@user_field('age')defage_field_factory(form,label,value):returnfactory('field:label:error:number',value=value,props={'label':label,'datatype':int})Note. The value of the custom field gets written to principal attributes as
extracted from the widget. Make sure to define the expected datatype in the
widget properties or define a suitable custom extractor.Principal ListingsXXXObject EventsYou can react to creation, modification and deletion of users and groups by
binding to the given event classes.These events are fired when the user manipulations are done in the UGM
management forms.necessary imports:fromzope.eventimportclasshandlerfromcone.ugmimporteventsDefining the event handlersfor users:@classhandler.handler(events.UserCreatedEvent)defon_user_created(event):print(f"user{event.principal}with id{event.principal.name}created")@classhandler.handler(events.UserModifiedEvent)defon_user_modified(event):print(f"user{event.principal}with id{event.principal.name}modified")@classhandler.handler(events.UserDeletedEvent)defon_user_deleted(event):print(f"user{event.principal}with id{event.principal.name}deleted")and for groups:@classhandler.handler(events.GroupCreatedEvent)defon_group_created(event):print(f"group{event.principal}with id{event.principal.name}created")@classhandler.handler(events.GroupModifiedEvent)defon_group_modified(event):print(f"group{event.principal}with id{event.principal.name}modified")@classhandler.handler(events.GroupDeletedEvent)defon_group_deleted(event):print(f"group{event.principal}with id{event.principal.name}deleted")ContributorsRobert Niederreiter (Author)Florian FriesdorfJens KleinChanges1.0a7 (2023-02-02)CatchAttributeErrorinmodel.user.User.expires. Happens in user add
form where user not exists yet.
[rnix]1.0a6 (2022-12-05)Removeexpirationyafowil blueprint fromcone.ugm.browser.expires.
Account expiration is now done with a regular date field since UGM backends
allow settingexpiresattributes as datetime objects as of node.ext.ugm
1.1.
[rnix]Moveusers_expires_attrandusers_expires_unitsettings to cone.ldap,
since they always have been used only for LDAP UGM backend.
[rnix]Exposeexpiresattribute of backend user incone.ugm.model.User.
[rnix]Fix general settings form according to changes in yafowil 3.0.
[rnix]1.0a5 (2022-10-06)Replace deprecated use ofNodifybyMappingNode.
[rnix]1.0a4 (2021-11-08)Adopt import path ofsafe_decodeandnode_path.
[rnix]1.0a3 (2021-10-25)FixUsersListingandGroupsListingsearch filter to ignoreNonevalues.Increase listing slice size to 15.
[rnix]Addchange_passwordform.
[rnix]Add support for objects events on user and group add/modify/delete.
[zworkb]1.0a2 (2020-11-12)Fix delete principal.
[rnix]1.0a1 (2020-07-09)UseContentAddFormandContentEditFormbehaviors instead of B/CAddBehaviorandEditBehaviorfor user and group form.
[rnix]Uselayout_configdecorator introduced incone.app 1.0rc1.
[rnix]Removecone.ugm.model.users.users_factoryandcone.ugm.model.groups.groups_factory. Register related node classes
directly as app entries.
[rnix]Bind UGM columns content view to UGM models.
[rnix]Move LDAP related code tocone.ldap.
[rnix]Users autoincrement start setting value may be empty in config.
[rnix]Do not remember users and groups on volatile storage.
[rnix]UseIUgm.invalidatefor invalidation of users and groups on UGM backend.
[rnix]Renamecone.ugm.browser.listing.ColumnListing.query_itemstolisting_items.
[rnix]Turncone.ugm.browser.group.Usersandcone.ugm.browser.user.Groupsproperty descriptors intoColumnListingderiving tiles.
[rnix]Remove superfluousjQuery.sortElements.jsandnaturalSort.js.
[rnix]Move plugin config code inside main hook function.
[rnix]Python 3 Support.
[rnix]Convert doctests to unittests.
[rnix]Usecone.app.ugm.ugm_backendinstead ofcone.app.cfg.auth.
[rnix]Usecone.tile.tiledecorator instead ofcone.tile.registerTile.
[rnix]Userequest.has_permissioninstead ofpyramid.security.has_permission.
[rnix]Remove inout widget. Listing widget is the only principal membership now.
Remove correspondingdefault_membership_assignment_widget,user_display_name_attributeandgroup_display_name_attributefrom
settings
[rnix]Change UI. Principal form and principal membership are not displayed
in right column together any more. When viewing a principals content, left
column displays the listing and right column the principal form. When
viewing a principal, left column displays the principal form and right
column displays the principal membership.
[rnix]Update to cone.app >= 1.0.
[rnix]Change license to LGPLv3.
[rnix]0.9.7Directly depend onlxmlinsetup.py[rnix, 2014-05-13]0.9.6Adopt dependencies.
[rnix, 2013-01-10]0.9.5Portrait CSS fix.
[rnix, 2012-10-30]Python 2.7 Support.
[rnix, 2012-10-16]adopt tocone.app0.9.4
[rnix, 2012-07-29]adopt tonode0.9.8
[rnix, 2012-07-29]adopt toplumber1.2
[rnix, 2012-07-29]Simplifycone.ugm.browser.actions.
[rnix, 2012-07-26]Add local manager functionality.
[rnix, 2012-07-25]0.9.4Get rid of BBB classes usage fromcone.app.
[rnix, 2012-05-18]Fix invalidation after settings form save.
[rnix, 2012-04-23]Portrait Image support.
[rnix, 2012-04-21]Configuration for attributes exposed to attribute map.
[rnix, 2012-04-19]Invalidate after creating principal or roles container.
[rnix, 2012-04-19]Adoptexpiresblueprint toyafowil.widget.datetime1.3.
[rnix, 2012-04-19]0.9.3Add Autoincrement Feature for user ids.
[rnix, 2012-03-30]0.9.2Account expiration widget improvements.
[rnix, 2012-03-20]0.9.1Add account expiration functionality.
[rnix, 2011-03-06]Make display field of In-Out widget configurable.
[rnix, 2011-01-31]Dynamic width CSS.
[rnix, 2011-12-18]Get rid of globalcone.ugm.backend.cone.app.cfg.authis returend
bycone.ugm.model.utils.ugm_backend.
[rnix, 2011-11-22]Explicit names for settings forms.
[rnix, 2011-11-18]Add node properties for users and groups to get displayed in navtree if
displayed.
[rnix, 2011-11-16]0.9Initial release.LicenseGNU LESSER GENERAL PUBLIC LICENSEVersion 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.This version of the GNU Lesser General Public License incorporates the terms
and conditions of version 3 of the GNU General Public License, supplemented
by the additional permissions listed below.Additional Definitions.As used herein, “this License” refers to version 3 of the GNU Lesser General
Public License, and the “GNU GPL” refers to version 3 of the GNU General
Public License.“The Library” refers to a covered work governed by this License, other than
an Application or a Combined Work as defined below.An “Application” is any work that makes use of an interface provided by the
Library, but which is not otherwise based on the Library. Defining a
subclass of a class defined by the Library is deemed a mode of using an
interface provided by the Library.A “Combined Work” is a work produced by combining or linking an Application
with the Library. The particular version of the Library with which the Combined
Work was made is also called the “Linked Version”.The “Minimal Corresponding Source” for a Combined Work means the Corresponding
Source for the Combined Work, excluding any source code for portions of the
Combined Work that, considered in isolation, are based on the Application,
and not on the Linked Version.The “Corresponding Application Code” for a Combined Work means the object code
and/or source code for the Application, including any data and utility programs
needed for reproducing the Combined Work from the Application, but excluding
the System Libraries of the Combined Work.Exception to Section 3 of the GNU GPL.You may convey a covered work under sections 3 and 4 of this License without
being bound by section 3 of the GNU GPL.Conveying Modified Versions.If you modify a copy of the Library, and, in your modifications, a facility
refers to a function or data to be supplied by an Application that uses the
facility (other than as an argument passed when the facility is invoked),
then you may convey a copy of the modified version:under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the function
or data, the facility still operates, and performs whatever part of its
purpose remains meaningful, orunder the GNU GPL, with none of the additional permissions of this
License applicable to that copy.Object Code Incorporating Material from Library Header Files.The object code form of an Application may incorporate material from a header
file that is part of the Library. You may convey such object code under terms
of your choice, provided that, if the incorporated material is not limited to
numerical parameters, data structure layouts and accessors, or small macros,
inline functions and templates (ten or fewer lines in length), you do both of
the following:Give prominent notice with each copy of the object code that the Library
is used in it and that the Library and its use are covered by this
License.Accompany the object code with a copy of the GNU GPL and this license
document.Combined Works.You may convey a Combined Work under terms of your choice that, taken together,
effectively do not restrict modification of the portions of the Library
contained in the Combined Work and reverse engineering for debugging such
modifications, if you also do each of the following:Give prominent notice with each copy of the Combined Work that the
Library is used in it and that the Library and its use are covered by
this License.Accompany the Combined Work with a copy of the GNU GPL and this license
document.For a Combined Work that displays copyright notices during execution,
include the copyright notice for the Library among these notices, as
well as a reference directing the user to the copies of the GNU GPL and
this license document.Do one of the following:Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form suitable
for, and under terms that permit, the user to recombine or relink
the Application with a modified version of the Linked Version to
produce a modified Combined Work, in the manner specified by section
6 of the GNU GPL for conveying Corresponding Source.Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time a
copy of the Library already present on the user’s computer system,
and (b) will operate properly with a modified version of the Library
that is interface-compatible with the Linked Version.Provide Installation Information, but only if you would otherwise be
required to provide such information under section 6 of the GNU GPL,
and only to the extent that such information is necessary to install
and execute a modified version of the Combined Work produced by
recombining or relinking the Application with a modified version of the
Linked Version. (If you use option 4d0, the Installation Information
must accompany the Minimal Corresponding Source and Corresponding
Application Code. If you use option 4d1, you must provide the
Installation Information in the manner specified by section 6 of the
GNU GPL for conveying Corresponding Source.)Combined Libraries.You may place library facilities that are a work based on the Library side by
side in a single library together with other library facilities that are not
Applications and are not covered by this License, and convey such a combined
library under terms of your choice, if you do both of the following:Accompany the combined library with a copy of the same work based on the
Library, uncombined with any other library facilities, conveyed under the
terms of this License.Give prominent notice with the combined library that part of it is a
work based on the Library, and explaining where to find the accompanying
uncombined form of the same work.Revised Versions of the GNU Lesser General Public License.The Free Software Foundation may publish revised and/or new versions of the
GNU Lesser General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.Each version is given a distinguishing version number. If the Library as you
received it specifies that a certain numbered version of the GNU Lesser General
Public License “or any later version” applies to it, you have the option of
following the terms and conditions either of that published version or of any
later version published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser General Public
License, you may choose any version of the GNU Lesser General Public License
ever published by the Free Software Foundation.If the Library as you received it specifies that a proxy can decide whether
future versions of the GNU Lesser General Public License shall apply, that
proxy’s public statement of acceptance of any version is permanent
authorization for you to choose that version for the Library.