Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 7cd14bb

Browse files
authored
Aggregated stats (v4.0.0) (#38)
1 parent 86490df commit 7cd14bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1549
-1481
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
.idea
1+
.idea
2+
vendor
3+
modules
4+
composer.lock

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
55

6+
## [v4.0.0]
7+
#### Added
8+
- aggregated statistics (logins and unique users)
9+
10+
#### Changed
11+
- new database tables
12+
- config options for table names replaced with one (optional) option `tableNames`
13+
- option 'config' for auth proc filter made optional
14+
- auth proc filter renamed to Statistics (PascalCase)
15+
- major refactoring
16+
17+
#### Removed
18+
- `detailedDays` config option
19+
- compatibility for deprecated database config options
20+
- duplicate code
21+
622
## [v3.2.1]
723
#### Fixed
824
- Fixed the bug in using double '$'

README.md

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,51 +15,38 @@ Once you have installed SimpleSAMLphp, installing this module is very simple. Fi
1515
## Configuration
1616
1. Install MySQL Database and create database for statistics and user.
1717
2. For this database run script to create tables. Script is available in config-templates/tables.sql.
18-
3. Copy config-templates/module_statisticsproxy.php to your folder vith config and fill it.
18+
3. Copy config-templates/module_proxystatistics.php to your config folder and fill it.
1919
4. Configure, according to mode
20-
* for mode PROXY, configure IdPAttribute filter from Perun module to get sourceIdPName from IdP metadata:
20+
* for PROXY mode, configure IdPAttribute filter from Perun module to get sourceIdPName from IdP metadata:
2121
```
22-
XX => [
23-
'class' => 'perun:IdPAttribute',
24-
'attrMap' => [
25-
'name:en' => 'sourceIdPName',
26-
],
22+
50 => [
23+
'class' => 'perun:IdPAttribute',
24+
'attrMap' => [
25+
'name:en' => 'sourceIdPName',
26+
],
2727
],
28-
// where XX is priority (for example 30, must not be used for other modules)
28+
// where 50 is priority (for example, must not be used for other modules)
2929
```
30-
* for mode IDP, configure `idpEntityId` and `idpName` in `module_statisticsproxy.php`
30+
* for IDP mode, configure entity ID and name in `module_proxystatistics.php`
3131
```
32-
/*
33-
* EntityId of IdP
34-
* REQUIRED FOR IDP MODE
35-
*/
36-
'idpEntityId' => '',
37-
/*
38-
* Name of IdP
39-
* REQUIRED FOR IDP MODE
40-
*/
41-
'idpName' => '',
32+
'IDP' => [
33+
'id' => '',
34+
'name' => '',
35+
],
4236
```
43-
* for mode SP, configure `spEntityId` and `spName` in `module_statisticsproxy.php`
37+
* for SP mode, configure entity ID and name in `module_proxystatistics.php`
4438
```
45-
/*
46-
* EntityId of SP
47-
* REQUIRED FOR SP MODE
48-
*/
49-
'spEntityId' => '',
50-
/*
51-
* Name of SP
52-
* REQUIRED FOR SP MODE
53-
*/
54-
'spName' => '',
39+
'SP' => [
40+
'id' => '',
41+
'name' => '',
42+
],
5543
```
56-
5. Configure proxystatistic filter
44+
5. Configure proxystatistics filter
5745
```
58-
XX => array(
59-
'class' => 'proxystatistics:statistics',
60-
'config' => [],
61-
),
62-
// where XX is priority (for example 50, must not be used for other modules)
46+
50 => [
47+
'class' => 'proxystatistics:Statistics',
48+
],
49+
// where 50 is priority (for example, must not be used for other modules)
6350
```
6451
6. Add to `config.php`:
6552
```

composer.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "cesnet/simplesamlphp-module-proxystatistics",
33
"description": "A SimpleSAMLPHP module for statistics",
4-
"version": "3.3.0-dev",
54
"type": "simplesamlphp-module",
65
"keywords": ["statistics","simplesamlphp"],
76
"license": "BSD-2-Clause",
@@ -12,10 +11,14 @@
1211
}
1312
],
1413
"require": {
15-
"php": ">=5.4.0",
16-
"cesnet/simplesamlphp-module-perun" : "~3.0",
14+
"php": ">=7.1.0",
15+
"cesnet/simplesamlphp-module-perun" : "^3.0",
1716
"simplesamlphp/simplesamlphp": "~1.17",
1817
"ext-mysqli": "*",
1918
"ext-json": "*"
19+
},
20+
"require-dev": {
21+
"squizlabs/php_codesniffer": "*",
22+
"symplify/easy-coding-standard": "^7.2"
2023
}
2124
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?php
2+
3+
/**
4+
* This is an example configuration of SimpleSAMLphp Perun interface and additional features.
5+
* Copy this file to default config directory and edit the properties.
6+
*
7+
* @author Pavel Vyskočil <[email protected]>
8+
* @author Pavel Břoušek <[email protected]>
9+
*/
10+
11+
$config = [
12+
13+
/*
14+
* Choose one of the following modes: PROXY, IDP, SP
15+
*/
16+
'mode' => 'PROXY',
17+
18+
/*
19+
* EntityId and name of IdP
20+
* REQUIRED FOR IDP MODE
21+
*/
22+
//'IDP' => [
23+
// 'id' => '',
24+
// 'name' => '',
25+
//],
26+
27+
/*
28+
* EntityId and name of SP
29+
* REQUIRED FOR SP MODE
30+
*/
31+
//'SP' => [
32+
// 'id' => '',
33+
// 'name' => '',
34+
//],
35+
36+
/*
37+
* Config for SimpleSAML\Database.
38+
* If not set, the global config is used.
39+
* @see SimpleSAML\Database
40+
*/
41+
'store' => [
42+
'database.dsn' => 'mysql:host=localhost;port=3306;dbname=STATS;charset=utf8',
43+
'database.username' => 'stats',
44+
'database.password' => 'stats',
45+
46+
/**
47+
* Configuration for SSL
48+
* If you want to use SSL, fill these values and uncomment the block of code
49+
*/
50+
//'database.driver_options' => [
51+
// PDO::MYSQL_ATTR_SSL_KEY => '', // Path for the ssl key file
52+
// PDO::MYSQL_ATTR_SSL_CERT => '', // Path for the ssl cert file
53+
// PDO::MYSQL_ATTR_SSL_CA => '', // Path for the ssl ca file
54+
// PDO::MYSQL_ATTR_SSL_CAPATH => '', // Path for the ssl ca dir
55+
//],
56+
],
57+
58+
/**
59+
* Which attribute should be used as user ID.
60+
* @default uid
61+
*/
62+
//'userIdAttribute' => 'uid',
63+
64+
/**
65+
* Database table names.
66+
* Default is to keep the name (as in `tables.sql`)
67+
*/
68+
'tableNames' => [
69+
//'statistics_sums' => 'statistics_sums',
70+
//'statistics_per_user' => 'statistics_per_user',
71+
//'statistics_idp' => 'statistics_idp',
72+
//'statistics_sp' => 'statistics_sp',
73+
],
74+
75+
/**
76+
* Authentication source name if authentication should be required.
77+
* Defaults to empty string.
78+
*/
79+
//'requireAuth.source' => 'default-sp',
80+
81+
/**
82+
* For how many days should the detailed statistics be kept. Minimum is 31.
83+
*/
84+
//'keepPerUser' => 62,
85+
];

config-templates/module_statisticsproxy.php

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)