README.md 12.6 KB
Newer Older
Marcello Pivanti's avatar
Marcello Pivanti committed
1
2
3
4
5
6
7
8
# Amos Admin 

User Profile management

### Installation

Add admin requirement in your composer.json:
```
Aster's avatar
Aster committed
9
"arter/amos-admin": "dev-master",
Marcello Pivanti's avatar
Marcello Pivanti committed
10
11
12
13
14
```

Enable the Admin modules in modules-amos.php, add :
```
 'admin' => [
Aster's avatar
Aster committed
15
	'class' => 'arter\amos\admin\AmosAdmin',
Marcello Pivanti's avatar
Marcello Pivanti committed
16
17
18
19
20
 ],

```
add admin migrations to console modules (console/config/migrations-amos.php):
```
Aster's avatar
Aster committed
21
'@vendor/arter/amos-admin/src/migrations'
Marcello Pivanti's avatar
Marcello Pivanti committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
```

If tags are needed enable tag roots for user in tag plugin.
To do so: 
- Activate tag plugin (check it is in modules configuration list)
- Open tag manager (admin privilege is required) url: <yourPlatformurl>/tag/manager
- Click on tag tree roots to enable
- In the last select of the page (user interest), enable for needed user roles. 

### Configurable fields 

Here the list of configurable fields, properties of module AmosAdmin.
If some property default is not suitable for your project, you can configure it in module, eg: 

```php
 'admin' => [
Aster's avatar
Aster committed
38
	'class' => 'arter\amos\admin\AmosAdmin',
Marcello Pivanti's avatar
Marcello Pivanti committed
39
40
41
42
43
44
45
46
	'enableRegister' => true, //changed property (default was false)
 ],
 
```
configuration example: 

```php
$modules['admin'] =  [
Aster's avatar
Aster committed
47
    'class' => 'arter\amos\admin\AmosAdmin',
Marcello Pivanti's avatar
Marcello Pivanti committed
48
49
50
51
	'enableRegister' => true,
	'organizationModuleName' => 'organizations',
	'modelMap' => [
		'User' => [
Aster's avatar
Aster committed
52
			'class' => 'arter\amos\porting\console\models\PortingUser',
Marcello Pivanti's avatar
Marcello Pivanti committed
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
		]
	],
     'fieldsConfigurations' => [
            'boxes' => [
                'box_account_data' => ['form' => true, 'view' => true],
                'box_dati_accesso' => ['form' => true, 'view' => true],
                'box_dati_contatto' => ['form' => true, 'view' => true],
                'box_dati_fiscali_amministrativi' => ['form' => false, 'view' => false],
                'box_dati_nascita' => ['form' => false, 'view' => false],
                'box_email_frequency' => ['form' => true, 'view' => true],
                'box_facilitatori' => ['form' => true, 'view' => true],
                'box_foto' => ['form' => true, 'view' => true],
                'box_informazioni_base' => ['form' => true, 'view' => true],
                'box_presentazione_personale' => ['form' => true, 'view' => true],
                'box_prevalent_partnership' => ['form' => true, 'view' => true],
                'box_privacy' => ['form' => true, 'view' => true],
                'box_questio' => ['form' => false, 'view' => false],
                'box_role_and_area' => ['form' => true, 'view' => true],
                'box_social_account' => ['form' => true, 'view' => true],
            ],
            'fields' => [
                'attivo' => ['form' => true, 'view' => true, 'referToBox' => 'box_account_data'],
                'codice_fiscale' => ['form' => false, 'view' => false, 'referToBox' => 'box_dati_fiscali_amministrativi'],
                'cognome' => ['form' => true, 'view' => true, 'referToBox' => 'box_informazioni_base'],
                'default_facilitatore' => ['form' => true, 'view' => true],
                'email' => ['form' => true, 'view' => false, 'referToBox' => 'box_dati_contatto'],
                'email_pec' => ['form' => false, 'view' => false, 'referToBox' => 'box_dati_contatto'],
                'facebook' => ['form' => true, 'view' => true, 'referToBox' => 'box_social_account'],
                'facilitatore_id' => ['form' => true, 'view' => true, 'referToBox' => 'box_facilitatori'],
                'googleplus' => ['form' => true, 'view' => true, 'referToBox' => 'box_social_account'],
                'linkedin' => ['form' => true, 'view' => true, 'referToBox' => 'box_social_account'],
                'nascita_comuni_id' => ['form' => false, 'view' => false, 'referToBox' => 'box_dati_nascita'],
                'nascita_data' => ['form' => false, 'view' => false, 'referToBox' => 'box_dati_nascita'],
                'nascita_nazioni_id' => ['form' => false, 'view' => false, 'referToBox' => 'box_dati_nascita'],
                'nascita_province_id' => ['form' => false, 'view' => false, 'referToBox' => 'box_dati_nascita'],
                'nome' => ['form' => true, 'view' => true, 'referToBox' => 'box_informazioni_base'],
                'note' => ['form' => true, 'view' => false, 'referToBox' => 'box_informazioni_base'],
                'presentazione_breve' => ['form' => true, 'view' => true, 'referToBox' => 'box_informazioni_base'],
                'presentazione_personale' => ['form' => true, 'view' => true, 'referToBox' => 'box_presentazione_personale'],
                'prevalent_partnership_id' => ['form' => true, 'view' => true, 'referToBox' => 'box_prevalent_partnership'],
                'privacy' => ['form' => true, 'view' => true, 'referToBox' => 'box_privacy'],
                'sesso' => ['form' => true, 'view' => false, 'referToBox' => 'box_informazioni_base'],
                'telefono' => ['form' => true, 'view' => false, 'referToBox' => 'box_dati_contatto'],
                'twitter' => ['form' => true, 'view' => true, 'referToBox' => 'box_social_account'],
                'ultimo_accesso' => ['form' => true, 'view' => true, 'referToBox' => 'box_account_data'],
                'ultimo_logout' => ['form' => true, 'view' => true, 'referToBox' => 'box_account_data'],
                'username' => ['form' => true, 'view' => false, 'referToBox' => 'box_dati_accesso'],
                'user_profile_age_group_id' => ['form' => true, 'view' => true, 'referToBox' => 'box_informazioni_base'],
                'user_profile_area_id' => ['form' => true, 'view' => false, 'referToBox' => 'box_role_and_area'],
                'userProfileImage' => ['form' => true, 'view' => true, 'referToBox' => 'box_foto'],
                'user_profile_role_id' => ['form' => true, 'view' => false, 'referToBox' => 'box_role_and_area'],
            ]
        ]
    ];
    .
    .
    . 
    return $modules;
```



### Module configuration params 

* **enableRegister** - boolean, default = false  
set to true to enable user register to the application and create his own userprofile  

Aster's avatar
Aster committed
120
121
122
123
124
125
* **showLogInRegisterButton** - boolean, default = true  
set to true to enable user register button on login form  

* **hideStandardLoginPageSection** - boolean, default = false  
If true hide the login page section where the user can insert username and password.  

Marcello Pivanti's avatar
Marcello Pivanti committed
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
* **textWarningForRegisterDisabled** - string
set the text that will to show if the register is disabled

* **enableUserContacts** - boolean, default = true  
enable connection to users, send private messages, and see 'contacts' in section 'NETWORK' of the user profile

* **cached** - boolean, default = false  
enable or not admin query caching

* **cacheDuration** - int, default = 84600  (24 hours)  
seconds of query caching duration if $cache = true - default is 1 day 

* **bypassWorkflow** - boolean, default = false  
If true the plugin bypass the user profile workflow and show nothing of it

Aster's avatar
Aster committed
141
142
* **htmlMailContent** - string, default = '@vendor/arter/amos-admin/src/mail/user/credenziali-html'  
This is the html used to render the message of the e-mail. In the view is available the variable $profile that is an instance of 'arter\amos\admin\models\UserProfile'.
Marcello Pivanti's avatar
Marcello Pivanti committed
143

Aster's avatar
Aster committed
144
145
* **textMailContent** - string, default = '@vendor/arter/amos-admin/src/mail/user/credenziali-text'  
This is the text used to render the message of the e-mail. In the view is available the variable $profile that is an instance of 'arter\amos\admin\models\UserProfile'
Marcello Pivanti's avatar
Marcello Pivanti committed
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

* **fieldsConfigurations** - array, default:
```php
public $fieldsConfigurations = [
        'boxes' => [
            'box_informazioni_base' => ['form' => true, 'view' => true]
        ],
        'fields' => [
            'nome' => ['form' => true, 'view' => true, 'referToBox' => 'box_informazioni_base'],
            'cognome' => ['form' => true, 'view' => true, 'referToBox' => 'box_informazioni_base'],
            'userProfileImage' => ['form' => true, 'view' => true, 'referToBox' => 'box_foto']
        ]
    ];
```
This array contains all configurations for boxes and fields to enable in form/wizard and view for model UserProfile.
Find in /src/views/user-profile/boxes all the possible subviews to enable/disable for user profile. 

* **profileRequiredFields** - array, default = ['nome', 'cognome', 'status', 'presentazione_breve']  
Mandatory fields in user profile form: by default name, surname, profile status and short presentation (I present myself in 140 characters) are mandatory.  
If in your platform, for example, you don't want short presentation to be a mandatory field, overwrite profileRequiredFields property as below:
```php
'admin' => [
Aster's avatar
Aster committed
168
    'class' => 'arter\amos\admin\AmosAdmin',
Marcello Pivanti's avatar
Marcello Pivanti committed
169
170
171
172
173
174
175
176
177
178
179
    'profileRequiredFields' => ['nome', 'cognome', 'status'] 
],
```
* **confManager** - ConfigurationManager, default = null  
//TODO explain

  
* **defaultUserRole** - string, default = 'BASIC_USER'  
At user creation, it is possible to customize the Rbac role to assign to a new user, default is BASIC_USER role.

* **organizationModuleName** - string, default = 'organizzazioni'  
Aster's avatar
Aster committed
180
This is the module name (you used as array key in modules configuration of your platform) referring to a module extending arter\amos\core\interfaces\OrganizationsModuleInterface
Marcello Pivanti's avatar
Marcello Pivanti committed
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
It is used to give the possibility to customize the entity type used to set user profile prevalent partnership, for example.
//TODO explain better

* **allowLoginWithEmailOrUsername** - boolean, default = true  
This feature allow user to login both with username or email. It's enabled by default.

* **userCanSelectUsername** - boolean, default = false  
If this is set to false, when a new user is created the platform automatically set the username with the part before '@' of the email. If the username is not available the system generate an unique one. by default the user cannot select the username.

* **disableUpdateChangeStatus** - boolean, default = false  
If this is set to false the popup on my profile modify is disabled.

* **enableWorkflowChangeStatusMails** - boolean, default = true  
If this is set to false the mails on change profile workflow status are disabled.

* **whiteListProfileImageExts** - string, default = jpeg, jpg, png, gif  
Used to set the allowed extensions for profile images.

* **associateTutor** - int, default = null 
At the creation of the user, set the user (Tutor) as contact of the created use.

* **defaultPrivateMessage** - bool, default = null
At the creation of the user, send a private message from the tutor

* **roleAndAreaOnOrganizations** - boolean, default = false  
If true, hide roles and areas standard and enable it on the single network organization row.

* **roleAndAreaFromOrganizationsWithTypeCat** - boolean, default = false  
If true, uses "type_cat" field in the roles and areas queries.

* **sendUserAssignmentsReportOnDelete** - boolean, default = false
To enable sending a report via email to all admin users when a user deletes himself or is deleted by another user.
The email contains a recap of all assignments of the deleted user inside the app. 

* **enableSendMessage** - boolean, default = false  
If this is true and $enableUserContacts is false all users see the "send message" button on view icon.

* **helpLinkAction** - string, default = null  
The action to run from backend to go in the technical area section via the email and the private message sent enabling the param above.

Aster's avatar
Aster committed
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
* **showFacilitatorForModuleSelect** - boolean, default = false  
Enable modify facilitator

* **dontCheckOneTagPresent** - boolean, default = false  
If true the model validation doesn't check if there's at least one tag present for non ADMIN users.

* **enableMultiUsersSameCF** - boolean, default = false  
If true the model validation doesn't check the unique of che fiscal code.

* **enableInviteUserToEvent** - boolean, default = false  
If true enable a link on single user useful to invite a user to a published event with an event community.


* **createContentInMyOwnCommunityOnly** - boolean, default = false
If true the validate basic user can create contents only in his/her own Communities

* **actionBlacklistManageInvite** - array, default = [] 
Array used for checking that action controller can use invitation button.

Marcello Pivanti's avatar
Marcello Pivanti committed
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
### How to use Token groups 
First create the token group and the you can use the following functions. 
* You can login using the token, using the link /admin/security/login?token=[__TOKEN__]
* After the login you will be redirected to the url set on the TokenGroup

#####  Get the created group of token (for a model, or model/model_id)
```php
TokenGroup::getTokenGroup($classname, $id = null)
```
#####  Generate the user tokens for the group using  the user_id (array)
```php
$tokenGroup->generateTokenUsersByIds($ids)
```
#####  Generate a single token using the user_id, @return TokenUsers
```php
$tokenUser = $tokenGroup->generateSingleTokenUser($id)
```