Git Product home page Git Product logo

pimcore-members's Introduction

Pimcore Members Bundle

Add frontend user authentication and document restriction to pimcore.

Join the chat at https://gitter.im/pimcore/pimcore Software License Latest Release Tests PhpStan

Release Plan

Release Supported Pimcore Versions Supported Symfony Versions Release Date Maintained Branch
5.x 11.0 6.2 28.09.2023 Feature Branch master
4.x 10.5 - 10.6 5.4 22.11.2021 Unsupported 4.x
3.x 6.0 - 6.8 3.4, ^4.4 21.07.2019 Unsupported 3.x
2.5 5.4, 5.5, 5.6, 5.7, 5.8 3.4 18.07.2019 Unsupported 2.5
1.5 4.0 -- 07.07.2017 Unsupported pimcore4

Features

  • Create Members in backend
  • Allow Members to register in frontend
  • Restrict documents, objects and assets to specific user roles

Installation

Please read the installation instructions before going deep with Members!

Composer Installation

  1. Add code below to your composer.json
"require" : {
    "dachcom-digital/members" : "~5.0.0"
}

Add Bundle to bundles.php:

return [
    MembersBundle\MembersBundle::class => ['all' => true],
];
  • Execute: $ bin/console pimcore:bundle:install MembersBundle

Upgrading

  • Execute: $ bin/console doctrine:migrations:migrate --prefix 'MembersBundle\Migrations'

Optional: Class Installation

Read more about the required classes below).

bin/console members:install:class

Security Installation

It is not possible to merge security configurations from multiple locations, including bundles. Instead, you have to move them to one single config file, e.g. config/packages/security.yaml. Please adopt security_auth_manager.yaml and merge your own firewall configuration into one single file.

Route Installation

MembersBundle does not include any routes per default. Otherwise, it would be hard for you to change or override included routes.

Include all Routes

# config/routes.yaml
app:
    resource: '@MembersBundle/config/pimcore/routing/all.yaml'

Just include some Routes

# config/routes.yaml
members_auth:
    resource: '@MembersBundle/config/pimcore/routing/auth.yaml'
    prefix: /{_locale}/members #change your prefix if you have to.

Class Installation

Since Members should be the one and only frontend authentication bundle, we need to add the most flexibility as possible. But no worries, it's still simple to integrate.

There is also a class installer command. If you're not using any special class configuration, feel free to use this command: $ bin/console members:install:class Use the -o argument to also install the SsoIdentity Class

You need two classes: User and Group. So let's create it:

User

  1. Create a class and call it MembersUser
  2. Add parent class: \MembersBundle\Adapter\User\AbstractUser
  3. Add fields:
Name Field Type Comment
userName Input
email Input Note: Do not add this field if you're using the CMF.
confirmationToken Input must set to it read only
lastLogin Date & Time must set to it read only
password Password Hide it, if you want. Note: Do not add this field if you're using the CMF.
passwordRequestedAt Date & Time must set to it read only
groups User Group This field comes with Members

membersUser is the default name, you may want to change it. Read here how to achieve that.

Customer Data Framework

If you want to use the Customer Data Framework you need to do some further work. Read more about it here.

SSO Login

You want to enable the SSO Feature in Members? Read more about it here.

Group

  1. Create a class and call it MembersGroup
  2. Add parent class: \MembersBundle\Adapter\Group\AbstractGroup
  3. Add fields:
Name Field Type Comment
name Input
roles Multiselection Set "Options Provider Class or Service Name" to @MembersBundle\CoreExtension\Provider\RoleOptionsProvider

membersGroup is the default name, you may want to change it. Read here how to achieve that.

Feel free to add additional fields since those are just the required ones. That's it. Members will use those classes to manage authentication and group management.

Email Configuration

You're almost there, just check the email configuration and you're good to go.


User Management: Further Information


Restrictions

Learn more about the Members Restriction feature:


Single Sign On (SSO) with OAuth2

Upgrade Info

Before updating, please check our upgrade notes!

Copyright and license

Copyright: DACHCOM.DIGITAL
For licensing details please visit LICENSE.md

pimcore-members's People

Contributors

aarongerig avatar cruiser13 avatar dasraab avatar dpfaffenbauer avatar galcf avatar geekdevs avatar jdreesen avatar kathangeorg avatar kjkooistra-youwe avatar ktallafus avatar lorextera avatar loshawlos avatar lukas-schnieper avatar mittererr avatar pascalmoser avatar scrummer avatar solverat avatar youwe-petervanderwal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pimcore-members's Issues

Admin register notification is sent to sign up user

I'm not sure if this is intended behaviour - although I can't see why it would make sense:
If "post_register_type" is "confirm_by_admin" and "send_admin_mail_after_register" is true, the notification mail with the admin deep link is sent to the user that just signed up for a new account.

I would expect this mail being sent to an admin instead, which probably has to be defined in the email template settings. While this actually works, the signup user still receives a copy of this mail, because the "user notification" with "admin template" is hardcoded here:

$this->sendMessage($template, $mailParams, (string)$user->getEmail());

I guess this is not desirable - am I wrong?

Issues with user registering

I'd like to report 2 issues I have with the plug-in, which makes it totally unusable for me (what good is a members plug-in when I can't create members?):

  • Whenever I'm creating a member through front-end, I get the error ParentID and ID is identical, an element can't be the parent of itself.
  • Whenever I'm creating a member through back-end, for whatever reason, the member object is not found when trying to log in. Resetting the password works fine, but whenever I log in, I get \Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND.

I'm not sure what you would need to help resolving this issues, so please let me know.

Profile edit does not check for existing username when it is changed

The edit profile form allows to change the username. But it does noch check for the new username to be alredy in use. So I'm able to change it to an already existing username. After that none of the 2 users is able to login.

Steps to reproduce:

  1. Register new user "aaa" and activate the account
  2. Register new user "bbb" and activate the account.
  3. Login as user "bbb" and use the profile edit form an change the username to "aaa"
    => This does not trigger an error, the new username is written to the user object.
  4. Try to login using username "aaa" (which is now the username of 2 users)
    => None of the 2 passwords work. Login no longer possible

[Members2] Implement Roles to Groups

  • removerole_hierarchy in security config. It's easily possible to to add stuff like that in project context if needed.
  • allow role selection in group class

Remove translation_domain config

Within issue #26, we changed the validator translation domain globally to messages:

validator.translation_domain: 'messages'

This is quite wrong since a bundle never should change validator domains globally. The right way to change validation messages is to add them to /app/Resources/translations/validators.LANG.yml or by changing the domain in the app:

parameters:
    validator.translation_domain: 'messages'

@geekdevs if you still want/need to add validator messages to the pimcore message domain, please do like described above.

AreaBuilder

Generates default view params to allow user to create a custom login box (like the area in a document) from a object related context.

$areaBuilder = new AreaBuilder('object');
$areaBuilder->setup()
        ->setEditMode($this->view->editmode)
        ->setBackUrl($this->view->getParam('back'))
        ->setCurrentUrl($this->view->getRequest()->getRequestUri())
        ->setRedirectAfterSuccess($loginBrick->getRedirectAfterSuccess())
        ->setSnippetAfterLogin($loginBrick->getShowSnippedWhenLoggedIn())
        ->setHideAfterLogin($loginBrick->getHideWhenLoggedIn());
$params = $areaBuilder->getViewParams();

Use members templates inside my views?

Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? yes

Hey again,

I'm not really that experienced with using twig but I got my site working on twig now because I want to include the templates you provide inside my views like so:

{% extends 'Fred/layout.html.twig' %}

{% block content %}
    {{ include('MembersBundle::Registration/register.html.twig') }}
{% endblock %}

It always throws an error Variable "form" does not exist. Is my approach totally wrong? Or am I missing something?
My goal is to use the register form/login form etc inside my custom styling.

Thanks in advance

User after-confirmation email is not sent

Even when setting send_user_mail_after_confirmed: trueafter-confirmation email does not send.

This is likely the issue:

|| $this->configuration->getConfig('post_register_type') !== 'confirm_by_admin') {

$this->configuration->getConfig('post_register_type') !== 'confirm_by_admin'

!== should be === here I believe so that it won't send email if confirmed by admin and would send it otherwise.

Validation Translations

Q A
Bug report? not really
Feature request? no
BC Break report? no
RFC? no

With case #45 the default validation domain has been reverted. But: Members still install Pimcore Shared Translations and they don't work out of the box. So it is unclear for the Developer how to use them. You can either change the validation translation domain to 'messages' or create a validations.yml translation file.

I think Members should supply a default 'validations.yml' translation file and remove them from the shared translation.

Php Templates with current version

Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? yes/no

Hey,
is there a possibility to use php-templates instead of the twig-templates?

Missing reset hash

I've just started using your plugin, and I just now realized that seemingly nowhere the reset hash actually gets sent with the email.

Session problem

When I tried to use this plugin with Hybridauth in pimcore I get this error:
PHP Fatal error: Uncaught Zend_Session_Exception: session has already been started by session.auto-start or session_start()
How I can fix this ?
Thanks.

Allow Asset Restriction

  • allow restriction for assets in /restricted-assets folder
  • create static method in observer to check if asset is restricted

[Members2] Implement members_build_nav twig Extension

Usage

According to this we need a custom nav builder.

{% set nav = members_build_nav(currentDoc, documentRootDoc, null, true) %}

How it works

  • Generates a custom cache key depending on active user (groups).
  • Check each document if it's restricted and set it to disabled with so.

[Frontend Routes] Members routes overwrite pimcore static routes

Whenever I'd like to create my own pimcore static routes to overwrite the default MemberBundle routes, my routes are overridden by the default one's.

For example:

// Should overwrite the login route
1 => [
    "id" => 1,
    "name" => "members_user_security_login",
    "pattern" => "/^\\/[a-z]{2}\\/login/",
    "reverse" => "/%_locale/login",
    "module" => "MembersBundle",
    "controller" => "Auth",
    "action" => "login",
    "variables" => "_locale",
    ...
],
// Redirect to login page
public function defaultAction()
{
    return $this->redirect($this->get('router')->generate('members_user_security_login'));
}

This should redirect me to http://domain.com/de/login instead it redirects me to http://domain.com/de/members/login.

Am I missing something? If not, could the routing be refactored so the routes may be overridden?

Thanks! ๐Ÿ˜„

Restricted Content Elements

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no

bildschirmfoto 2018-07-18 um 16 29 23

  • Implement Button to each content element to allow user group selection
  • Lucene Search: How to detect and crawl restricted elements?

PostConfirmationListener is registered twice (causing double emails to be sent)

MembersBundle\EventListener\PostConfirmationListener is declared twice and is fired twice when dispatched. This is causing registration confirmation emails to be sent twice.
Simply removing one of declarations fixes the issue, so should we kill one of those?

  1. MembersBundle\EventListener\PostConfirmationListener:

  2. members.event_listener.post_confirmation:

[Improvement] Add Access Privileges to Links

It would be very helpful for building up the navigation when the Access Restrictions where available for Links too.
We do not only use Documents but often use Links when building flyout/dropdown navigations.

Cannot install with console

Cannot install this extension with console. I see this error:

No entry is registered for key 'pimcore_admin_user'

Testing on fresh installation of pimcore 5, build 108.
And latest dev master of this extension (c5c78a3)

Steps to reproduce:

  • composer require dachcom-digital/members:dev-master#c5c78a3fc23ac2435727bbaca5c86073b7bd37b7
  • bin/console pimcore:bundle:enable MembersBundle
  • bin/console cache:clear
  • bin/console pimcore:bundle:install MembersBundle

[Auth] Logout does not work in production mode

Ever had the issue that as soon as Pimcore is in production mode, the logout route does not function anymore? Everything works well in debug (dev) mode. Cache clear does not work, nor are the routes wrong or anything... it's a miracle!

Here's my routing config:

members_auth:
    resource: '@MembersBundle/Resources/config/pimcore/routing/auth.yml'
    prefix: /{_locale}

Actual route (output of bin/console debug:router):

Name                                Method          Schema       Host     Path
----------------------------------- --------------- ------------ -------- -----------------
members_user_security_logout        GET|POST        ANY          ANY      /{_locale}/logout 

Security settings (output of bin/console debug:config security):

security:
    firewalls:
        members_fe:
            logout:
                path: members_user_security_logout
                target: /
                csrf_parameter: _csrf_token
                csrf_token_id: logout
                invalidate_session: true
                delete_cookies: {  }
                handlers: {  }

And I'm calling it in one of my twig templates like so:

{# Input #}
<a href="{{ path('members_user_security_logout') }}">Logout</a>

{# Output #}
<a href="/de/logout">Logout</a>

Any help on this would be greatly appreciated! Thanks!

Translations are not applied for validators

Translations do not apply for validation messages.
Although I see translations from this bundle are added to the admin, e.g. "members.validation.email.already_used" it's not applied during form validation.

For example registration form has IsUniqueEmail constraint which has default message email_already_used instead of members.validation.email.already_used.

But even if I update it to be "members.validation.email.already_used" it still won't translate because pimcore is only using "messages" translation domain for translations and symfony sets "validators" translation domain for constrain violations.

I managed to solve it by forcing pimcore use "messages" domain always:

parameters:
    validator.translation_domain: 'messages'

But I was wondering if you had better solution in mind and that's just a minor issue?

OAuth Connector

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes
  • add bridge
  • add example

[EventListener] Register confirmed message is constantly being sent to the user

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? yes

Whenever a user object gets updated (e.g. moving the object in the object tree or the user is logging in) the register confirmed message will be sent.

I guess something along those lines of code is wrong.

Pimcore Version 5.1.2 (build 192)
Members Version 2.0.1

Current configuration for "MembersBundle"
=========================================

members:
    send_admin_mail_after_register: false
    send_user_mail_after_confirmed: true
    post_register_type: confirm_by_admin
    restriction:
        enabled: false
        allowed_objects: {  }
    user:
        adapter:
            class_name: MembersUser
        initial_groups: {  }
    group:
        adapter:
            class_name: MembersGroup
    auth:
        adapter:
            class_name: null
            object_path: null
    emails:
        default:
            register_confirm: /email/register-confirm
            register_confirmed: /email/register-confirmed
            register_password_resetting: /email/password-reset
            admin_register_notification: /email/admin-register-notification
        sites: {  }
    relations:
        profile:
            form:
                type: AppBundle\Form\Type\ProfileType
                name: members_user_profile
                validation_groups:
                    - Profile
                    - Default
        registration:
            form:
                type: AppBundle\Form\Type\RegistrationType
                name: members_user_registration
                validation_groups:
                    - Registration
                    - Default
        change_password:
            form:
                type: MembersBundle\Form\Type\ChangePasswordFormType
                name: members_user_change_password_form
                validation_groups:
                    - ChangePassword
                    - Default
        resetting:
            retry_ttl: 7200
            token_ttl: 86400
            form:
                type: MembersBundle\Form\Type\ResettingFormType
                name: members_user_resetting_form
                validation_groups:
                    - ResetPassword
                    - Default

Restriction Icons in Tree View

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no

Show a restriction (+ inherited) icon in tree view for documents, assets and objects:

bildschirmfoto 2018-08-04 um 13 43 17

[docs] false configuration in docs

Q A
Bug report? no
Feature request? no
BC Break report? no
RFC? yes

In 20_CustomClassName.md the config keys to overwrite the class names are: members.adapter.class_name

Path should overwrite the default config from the bundle in config.yml (members.user.adapter.class_name & members.group.adapter.class_name)

'confirm_by_admin' | e-mail contains non-working deeplink

Hi there,

I'm just getting into using pimcore-members. Working great so far, thanks for providing this extension!

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

My use case requires me to have an admin confirm all new registrations. The e-mail I'm getting has a deeplink to the new account but the link doesn't work.

I dug a bit and found it is working if you remove the _locale=en& part from the link.
This is added here and I remove the conditional the link works perfectly fine. It also matches the deeplink to the object the info box in the backend gives me (also without the locale-part).

There probably is a good reason to have the conditional there though. I can't see it yet though.

Thanks

Exception after installing Bundle

In members/src/MembersBundle/Manager/UserManager.php at line 39 the required path "/members" is not available directly after installation, so the getId() part throws an exception. (tested multiple times).
Can be solved by checking for existance and add the required folder when not exitsting or by installer routines.
(Pimcore 5.0.0|132)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.