2017 © Pedro Peláez
 

library php-auth

User authentication and permission management.

image

o-log/php-auth

User authentication and permission management.

  • Tuesday, October 24, 2017
  • by o-log
  • Repository
  • 2 Watchers
  • 0 Stars
  • 1,331 Installations
  • JavaScript
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 3 Open issues
  • 100 Versions
  • 0 % Grown

The README.md

Подключение модуля

Подключить модуль в composer.json, (*1)

"require": {
  "o-log/php-auth": "2.*"
}

Выполнить composer update, (*2)

Регистрируем роутинг для админки и страниц регистрации и авторизации: добавить в точку входа сайта строку, (*3)

\OLOG\Auth\RegisterRoutes::registerRoutes();

Добавляем в конфиг сайта базу данных с идентификатором DB_NAME_PHPAUTH и указать для нее файл sql ..., (*4)

DBConfig::setDBSettingsObj(
  AuthConstants::DB_NAME_PHPAUTH,
  new DBSettings('localhost', 'db_projectname', 'root', '1', 'vendor/o-log/php-auth/db_phpauth.sql')
);
  1. Выполнить cli.php в корне сайта чтобы создать таблицы для пользователей и записи пермишенов

После этого админка авторизации должна заработать по адресу /admin/auth, (*5)

Изначально она будет недоступна, потому что нет ни одного пользователя, который имел бы к ней доступ. Чтобы создать такого пользователя выполняем команду:, (*6)

php bin/pa_makeuser.php username password

Замечание: сейчас для хранения сессий используется только мемкеш, поэтому на компе должен быть рабочий мемкеш и в конфиге должна быть настройка такого вида:, (*7)

CacheConfig::addServerSettingsObj(new MemcacheServerSettings('localhost', 11211));

Создание нового разрешения в другом модуле

Создаем константу в классе Модуль/Permissions (название класса можно использовать любое, это просто удобное соглашение), (*8)

<?php

namespace MODULENAME;

class Permissions
{
    const PERMISSION_MODULENAME_ACCESS_ADMIN = 'PERMISSION_MODULENAME_ACCESS_ADMIN';
}

Имя константы примерно такое: PERMISSION_MODULENAME_MANAGE_NODES где MODULENAME - имя вашего модуля, а MANAGE_NODES - пример названия собственно разрешения., (*9)

Эта константа нужна для использования в коде для проверки разрешений., (*10)

Имя разрешения надо вставить в таблицу разрешений: руками добавить sql-запрос в файл sql-запросов модуля. Вот пример:, (*11)

'insert into olog_auth_permission (title) values ("PERMISSION_MODULENAME_MANAGE_NODES") /* 364563456 */;',

Запись в таблице будет использоваться админкой для назначения разрешений операторам., (*12)

Инструкция по добавлению владельца к модели

Добавить поля владельцев с внешними ключами - owner_user_id int nullable - owner_group_id int nullable, (*13)

Добавить в implements InterfaceOwner, (*14)

Добавить в beforeSave модели инициализацию полей владельцев из текущего пользователя и его основной группы:, (*15)

public function beforeSave()
{
    OwnerAssign::assignCurrentUserAsOwnerToObj($this);
}

Добавить фильтры к спискам: CRUDTableFilterOwner, (*16)

Добавить проверку прав в редакторы: OwnerCheck::currentUserOwnsObj(), (*17)

Если нужно - проставить владельцев для существующих моделей, (*18)

The Versions

24/10 2017

dev-master

9999999-dev

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

24/10 2017

4.2

4.2.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

22/10 2017

4.1

4.1.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

16/10 2017

4.0

4.0.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

14/06 2017

3.3

3.3.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

14/06 2017

dev-sf_config_fix

dev-sf_config_fix

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

25/05 2017

3.2

3.2.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

19/05 2017

3.1

3.1.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

19/05 2017

3.0

3.0.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

21/03 2017

dev-mk-logger

dev-mk-logger

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

21/03 2017

2.70

2.70.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

10/03 2017

2.69

2.69.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

03/03 2017

2.68

2.68.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

03/03 2017

dev-mk-perm-to-user

dev-mk-perm-to-user

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

03/03 2017

2.67

2.67.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

The Development Requires

20/02 2017

dev-email_requested_field

dev-email_requested_field

User authentication and permission management.

  Sources   Download

The Requires

 

01/02 2017

dev-auth_11

dev-auth_11

User authentication and permission management.

  Sources   Download

The Requires

 

01/02 2017

2.66

2.66.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

01/02 2017

dev-auth_1

dev-auth_1

User authentication and permission management.

  Sources   Download

The Requires

 

31/01 2017

2.65

2.65.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

30/01 2017

2.64

2.64.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

27/01 2017

2.63

2.63.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

24/01 2017

2.62

2.62.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

24/01 2017

dev-mk-type-hinting

dev-mk-type-hinting

User authentication and permission management.

  Sources   Download

The Requires

 

17/01 2017

2.61

2.61.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

17/01 2017

2.60

2.60.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

17/01 2017

2.59

2.59.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

12/01 2017

2.58

2.58.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

12/01 2017

dev-imb_153_client

dev-imb_153_client

User authentication and permission management.

  Sources   Download

The Requires

 

29/12 2016

2.57

2.57.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

28/12 2016

dev-paa_2

dev-paa_2

User authentication and permission management.

  Sources   Download

The Requires

 

28/12 2016

2.56

2.56.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

26/12 2016

2.55

2.55.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

20/12 2016

2.54

2.54.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

20/12 2016

2.53

2.53.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

13/12 2016

2.52

2.52.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

13/12 2016

dev-mk-cookies3

dev-mk-cookies3

User authentication and permission management.

  Sources   Download

The Requires

 

13/12 2016

2.50

2.50.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

13/12 2016

dev-mk-cookies2

dev-mk-cookies2

User authentication and permission management.

  Sources   Download

The Requires

 

13/12 2016

2.49

2.49.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

13/12 2016

dev-mk-cookies

dev-mk-cookies

User authentication and permission management.

  Sources   Download

The Requires

 

09/12 2016

dev-imb_880_collapsible

dev-imb_880_collapsible

User authentication and permission management.

  Sources   Download

The Requires

 

09/12 2016

2.48

2.48.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

09/12 2016

2.47

2.47.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

01/12 2016

2.46

2.46.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

30/11 2016

2.45

2.45.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

30/11 2016

dev-imb_844_2

dev-imb_844_2

User authentication and permission management.

  Sources   Download

The Requires

 

29/11 2016

2.44

2.44.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

29/11 2016

dev-imb_844_users

dev-imb_844_users

User authentication and permission management.

  Sources   Download

The Requires

 

28/11 2016

2.43

2.43.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

02/11 2016

dev-mk-user-to-group-admin

dev-mk-user-to-group-admin

User authentication and permission management.

  Sources   Download

The Requires

 

02/11 2016

2.42

2.42.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

01/11 2016

2.41

2.41.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

01/11 2016

dev-paa_1

dev-paa_1

User authentication and permission management.

  Sources   Download

The Requires

 

31/10 2016

2.40

2.40.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

31/10 2016

2.39

2.39.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

27/10 2016

2.38

2.38.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

25/10 2016

2.37

2.37.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

25/10 2016

dev-mk-owner-filter

dev-mk-owner-filter

User authentication and permission management.

  Sources   Download

The Requires

 

25/10 2016

2.36

2.36.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

24/10 2016

2.35

2.35.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

24/10 2016

2.33

2.33.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

21/10 2016

2.32

2.32.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

21/10 2016

2.31

2.31.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

21/10 2016

dev-mk-owner-filter-sql

dev-mk-owner-filter-sql

User authentication and permission management.

  Sources   Download

The Requires

 

21/10 2016

2.34

2.34.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

19/10 2016

2.30

2.30.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

19/10 2016

2.29

2.29.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

19/10 2016

2.28

2.28.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

19/10 2016

2.27

2.27.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

18/10 2016

dev-mk-has-permissions

dev-mk-has-permissions

User authentication and permission management.

  Sources   Download

The Requires

 

18/10 2016

2.26

2.26.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

18/10 2016

dev-mk-user-owns-obj

dev-mk-user-owns-obj

User authentication and permission management.

  Sources   Download

The Requires

 

18/10 2016

2.25

2.25.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

17/10 2016

2.24

2.24.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

17/10 2016

2.23

2.23.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

13/10 2016

2.22

2.22.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

13/10 2016

2.21

2.21.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

13/10 2016

2.20

2.20.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

13/10 2016

2.19

2.19.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

12/10 2016

2.18

2.18.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

11/10 2016

2.17

2.17.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

11/10 2016

2.16

2.16.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

04/10 2016

2.15

2.15.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

04/10 2016

dev-fix_filters

dev-fix_filters

User authentication and permission management.

  Sources   Download

The Requires

 

04/10 2016

2.14

2.14.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

03/10 2016

dev-fix_forms

dev-fix_forms

User authentication and permission management.

  Sources   Download

The Requires

 

03/10 2016

dev-ololo

dev-ololo

User authentication and permission management.

  Sources   Download

The Requires

 

03/10 2016

dev-comment_field

dev-comment_field

User authentication and permission management.

  Sources   Download

The Requires

 

26/09 2016

2.13

2.13.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

15/09 2016

2.12

2.12.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

15/09 2016

2.11

2.11.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

24/08 2016

2.10

2.10.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

22/08 2016

2.9

2.9.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

18/08 2016

2.8

2.8.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

18/08 2016

2.7

2.7.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

18/08 2016

2.6

2.6.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

18/08 2016

2.5

2.5.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

17/08 2016

2.4

2.4.0.0

User authentication and permission management.

  Sources   Download

The Requires

 

17/08 2016

2.3

2.3.0.0

User authentication and permission management.

  Sources   Download

The Requires