Metadata-Version: 2.1
Name: cone.ugm
Version: 1.0a5
Summary: User and group management
Home-page: http://github.com/conestack/cone.ugm
Author: Cone Contributors
Author-email: dev@conestack.org
License: LGPLv3
Description: .. image:: https://img.shields.io/pypi/v/cone.ugm.svg
            :target: https://pypi.python.org/pypi/cone.ugm
            :alt: Latest PyPI version
        
        .. image:: https://img.shields.io/pypi/dm/cone.ugm.svg
            :target: https://pypi.python.org/pypi/cone.ugm
            :alt: Number of PyPI downloads
        
        .. image:: https://travis-ci.org/bluedynamics/cone.ugm.svg?branch=master
            :target: https://travis-ci.org/bluedynamics/cone.ugm
        
        .. image:: https://coveralls.io/repos/github/bluedynamics/cone.ugm/badge.svg?branch=master
            :target: https://coveralls.io/github/bluedynamics/cone.ugm?branch=master
        
        Plugin for `cone.app <http://packages.python.org/cone.app>`_ providing a
        user and group management UI.
        
        
        Features
        --------
        
        - Users and Groups CRUD
        - Principal membership of users and groups
        - Roles support
        - Local Manager Support
        - User and group form configuration
        
        
        Setup
        =====
        
        Prerequirements
        ---------------
        
        While installation ``lxml`` gets compiled, the required dev headers must be
        installed on the system.
        
        On debian based systems install:
        
        .. code-block:: shell
        
            $ apt-get install -y libxml2-dev libxslt1-dev
        
        
        Development and Testing
        -----------------------
        
        For testing and development, ``cone.ugm`` contains a buildout configuration.
        Download or checkout package and run:
        
        .. code-block:: shell
        
            cone.ugm$ ./bootstrap.sh python3
        
        
        Example Configuration
        ---------------------
        
        For testing and demo purposes, an example UGM configuration is contained in the
        ``cfg`` folder of the source package.
        
        It contains the configuration file ``ugm.xml``, containing the general UGM
        configuration and ``localmanager.xml``, containing the configuration about
        local users and groups management. These two files can be edited TTW via the
        settings UI.
        
        The ``ugm.ini`` file contains the application configuration:
        
        .. code-block:: ini
        
            [app:ugm]
            ...
        
            cone.plugins =
                cone.ugm
        
            ugm.backend = file
            ugm.config = %(here)s/ugm.xml
            ugm.localmanager_config = %(here)s/localmanager.xml
        
            ugm.users_file = %(here)s/../parts/ugm/users
            ugm.groups_file = %(here)s/../parts/ugm/groups
            ugm.roles_file = %(here)s/../parts/ugm/roles
            ugm.datadir = %(here)s/../parts/ugm/data
        
            ...
        
        In this example the ``file`` backend is configured as UGM backend. For
        configuring SQL or LDAP based backends, see documentation at ``cone.sql``
        respective ``cone.ldap``.
        
        Start the application:
        
        .. code-block:: shell
        
            cone.ugm$ ./bin/pserver cfg/ugm.ini
        
        and browse ``http://localhost:8081/``. Default ``admin`` user password is
        ``admin``.
        
        
        Configuration and Customization
        ===============================
        
        General
        -------
        
        For customizing the plugin, make an integration package and include it in
        your setup.
        
        
        Roles
        -----
        
        ``cone.ugm`` internally uses 3 roles in order to permit user actions.
        
        ``editor`` is permitted to manage membership, ``admin`` additionally is
        permitted to add, edit and delete users and groups, and ``manager`` is a
        superuser. If UGM is the only plugin used, you can reduce the available roles
        to this three:
        
        .. code-block:: python
        
            cone.app.security.DEFAULT_ROLES = [
                ('editor', 'Editor'),
                ('admin', 'Admin'),
                ('manager', 'Manager')
            ]
        
        
        Principal Forms
        ---------------
        
        The basic principal form customization happens in the ugm XML configuration
        file. Each field to render must have an entry in ``users_form_attrmap``
        respective ``groups_form_attrmap``:
        
        .. code-block:: xml
        
          <users_form_attrmap>
            <elem>
              <key>my_field</key>
              <value>My Field</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 use
        ``default_form_field_factory`` and register it with ``user_field``
        respective ``group_field``:
        
        .. code-block:: python
        
            from cone.ugm.browser.principal import default_form_field_factory
            from cone.ugm.browser.principal import user_field
            from functools import partial
        
            my_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 from ``cone.ldap`` and registers a
        user field factory for ``cn`` attribute in ``ldap`` backend:
        
        .. code-block:: python
        
            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:
        
        .. code-block:: python
        
            from yafowil.base import factory
        
            @user_field('age')
            def age_field_factory(form, label, value):
                return factory(
                    '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 Listings
        ------------------
        
        XXX
        
        
        Object Events
        =============
        
        You 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:
        
        .. code-block:: python
        
            from zope.event import classhandler
            from cone.ugm import events
        
        
        Defining the event handlers
        ---------------------------
        
        for users:
        
        .. code-block:: python
        
            @classhandler.handler(events.UserCreatedEvent)
            def on_user_created(event):
                print(f"user {event.principal} with id {event.principal.name} created")
        
            @classhandler.handler(events.UserModifiedEvent)
            def on_user_modified(event):
                print(f"user {event.principal} with id {event.principal.name} modified")
        
            @classhandler.handler(events.UserDeletedEvent)
            def on_user_deleted(event):
                print(f"user {event.principal} with id {event.principal.name} deleted")
        
        and for groups:
        
        .. code-block:: python
        
            @classhandler.handler(events.GroupCreatedEvent)
            def on_group_created(event):
                print(f"group {event.principal} with id {event.principal.name} created")
        
            @classhandler.handler(events.GroupModifiedEvent)
            def on_group_modified(event):
                print(f"group {event.principal} with id {event.principal.name} modified")
        
            @classhandler.handler(events.GroupDeletedEvent)
            def on_group_deleted(event):
                print(f"group {event.principal} with id {event.principal.name} deleted")
        
        
        Contributors
        ============
        
        - Robert Niederreiter (Author)
        - Florian Friesdorf
        - Jens Klein
        
        
        Changes
        =======
        
        1.0a5 (2022-10-06)
        ------------------
        
        - Replace deprecated use of ``Nodify`` by ``MappingNode``.
          [rnix]
        
        
        1.0a4 (2021-11-08)
        ------------------
        
        - Adopt import path of ``safe_decode`` and ``node_path``.
          [rnix]
        
        
        1.0a3 (2021-10-25)
        ------------------
        
        - Fix ``UsersListing`` and ``GroupsListing`` search filter to ignore
          ``None`` values.
        
        - Increase listing slice size to 15.
          [rnix]
        
        - Add ``change_password`` form.
          [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)
        ------------------
        
        - Use ``ContentAddForm`` and ``ContentEditForm`` behaviors instead of B/C
          ``AddBehavior`` and ``EditBehavior`` for user and group form.
          [rnix]
        
        - Use ``layout_config`` decorator introduced in ``cone.app 1.0rc1``.
          [rnix]
        
        - Remove ``cone.ugm.model.users.users_factory`` and
          ``cone.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 to ``cone.ldap``.
          [rnix]
        
        - Users autoincrement start setting value may be empty in config.
          [rnix]
        
        - Do not remember users and groups on volatile storage.
          [rnix]
        
        - Use ``IUgm.invalidate`` for invalidation of users and groups on UGM backend.
          [rnix]
        
        - Rename ``cone.ugm.browser.listing.ColumnListing.query_items`` to
          ``listing_items``.
          [rnix]
        
        - Turn ``cone.ugm.browser.group.Users`` and ``cone.ugm.browser.user.Groups``
          property descriptors into ``ColumnListing`` deriving tiles.
          [rnix]
        
        - Remove superfluous ``jQuery.sortElements.js`` and ``naturalSort.js``.
          [rnix]
        
        - Move plugin config code inside main hook function.
          [rnix]
        
        - Python 3 Support.
          [rnix]
        
        - Convert doctests to unittests.
          [rnix]
        
        - Use ``cone.app.ugm.ugm_backend`` instead of ``cone.app.cfg.auth``.
          [rnix]
        
        - Use ``cone.tile.tile`` decorator instead of ``cone.tile.registerTile``.
          [rnix]
        
        - Use ``request.has_permission`` instead of ``pyramid.security.has_permission``.
          [rnix]
        
        - Remove inout widget. Listing widget is the only principal membership now.
          Remove corresponding ``default_membership_assignment_widget``,
          ``user_display_name_attribute`` and ``group_display_name_attribute`` from
          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.7
        -----
        
        - Directly depend on ``lxml`` in ``setup.py``
          [rnix, 2014-05-13]
        
        
        0.9.6
        -----
        
        - Adopt dependencies.
          [rnix, 2013-01-10]
        
        
        0.9.5
        -----
        
        - Portrait CSS fix.
          [rnix, 2012-10-30]
        
        - Python 2.7 Support.
          [rnix, 2012-10-16]
        
        - adopt to ``cone.app`` 0.9.4
          [rnix, 2012-07-29]
        
        - adopt to ``node`` 0.9.8
          [rnix, 2012-07-29]
        
        - adopt to ``plumber`` 1.2
          [rnix, 2012-07-29]
        
        - Simplify ``cone.ugm.browser.actions``.
          [rnix, 2012-07-26]
        
        - Add local manager functionality.
          [rnix, 2012-07-25]
        
        
        0.9.4
        -----
        
        - Get rid of BBB classes usage from ``cone.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]
        
        - Adopt ``expires`` blueprint to ``yafowil.widget.datetime`` 1.3.
          [rnix, 2012-04-19]
        
        
        0.9.3
        -----
        
        - Add Autoincrement Feature for user ids.
          [rnix, 2012-03-30]
        
        
        0.9.2
        -----
        
        - Account expiration widget improvements.
          [rnix, 2012-03-20]
        
        
        0.9.1
        -----
        
        - Add 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 global ``cone.ugm.backend``. ``cone.app.cfg.auth`` is returend
          by ``cone.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.9
        ---
        
        - Initial release.
        
        
        License
        =======
        
        GNU LESSER GENERAL PUBLIC LICENSE
        
        Version 3, 29 June 2007
        
        Copyright © 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.
        
        0. 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.
        
        1. 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.
        
        2. 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:
        
            a) 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, or
        
            b) under the GNU GPL, with none of the additional permissions of this
               License applicable to that copy.
        
        3. 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:
        
            a) 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.
        
            b) Accompany the object code with a copy of the GNU GPL and this license
               document.
        
        4. 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:
        
            a) 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.
        
            b) Accompany the Combined Work with a copy of the GNU GPL and this license
               document.
        
            c) 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.
        
            d) Do one of the following:
        
                0) 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.
        
                1) 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.
        
            e) 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.)
        
        5. 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:
        
            a) 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.
        
            b) 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.
        
        6. 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.
        
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Provides-Extra: test
