1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minchat_ynh.git synced 2024-09-03 19:36:29 +02:00

New setup defaults

This commit is contained in:
Chtixof 2015-04-12 15:35:06 +02:00
parent 7ed567ad0a
commit 48a4db3f85
3 changed files with 16 additions and 13 deletions

View file

@ -21,12 +21,13 @@ Download, unzip and just copy the content of the `sources` folder to any folder
## Setup ## Setup
The setup is optional. If you leave it as is, there is a single unnamed room, opened to all users. If you want to customize the access control, edit the file `conf/setup.ini`. The interesting parameter is `auth` that indicates which user is authorized to which room. The setup is optional. If you leave it as is, there is a single unnamed room, opened to all users. If you want to customize the access control, edit the file `conf/setup.ini`. The interesting parameter is `auth` that indicates which user is authorized to which room.
In this example `auth = John:Game,Mary:Game,John:Family,Tim:Family,admin:,:Public`, In this example `auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Public,*:`,
- John can access the Game room, the Family room and the Public room - `John:Game,John:Family' = John can access the Game room, the Family room and the Public room
- Mary can access the Game room and the Public room - `Mary:Game' = Mary can access the Game room and the Public room
- Tim can access the Family room and the Public room - `Tim:Family' = Tim can access the Family room and the Public room
- admin can access all rooms - `admin:*' = admin can access all rooms
- other users can only acccess the Public room - `*:Public' = everybody can only acccess the Public room
- `*:' = everybody can access the unnamed room
## Screen shot ## Screen shot
![screenshot](https://raw.githubusercontent.com/chtixof/databank/master/minchat_ynh/minchat_ynh_screenshot01.gif) ![screenshot](https://raw.githubusercontent.com/chtixof/databank/master/minchat_ynh/minchat_ynh_screenshot01.gif)

View file

@ -6,6 +6,7 @@ interval = 2500 ; milliseconds
; :room with no user name is a room opened to any user name ; :room with no user name is a room opened to any user name
; user: with no room name is a user allowed to every room ; user: with no room name is a user allowed to every room
; default = single unnamed room and free user names ; default = single unnamed room and free user names
auth=*:
; Example: ; Example:
;auth = John:Game,Mary:Game,John:Family,Tim:Family,admin:,:Public ;auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Public,*:

View file

@ -15,7 +15,7 @@ function deleteOldHistory() {
// init setup.ini parms // init setup.ini parms
$ini = parse_ini_file('conf/setup.ini'); $ini = parse_ini_file('conf/setup.ini');
$interval= getarr($ini,'interval',2500); $interval= getarr($ini,'interval',2500);
$auth= explode(',',getarr($ini,'auth','')); $auth= explode(',',getarr($ini,'auth','*:'));
// read args // read args
$name=""; $name="";
@ -35,14 +35,15 @@ if ($name.$room=="") {
// no args // no args
$prompt = "Please fill in the form to continue:"; $prompt = "Please fill in the form to continue:";
} else { } else {
// user name mandatory in any case
if ($name=="") {$prompt = "<em>User name missing.</em>";} if ($name=="") {$prompt = "<em>User name missing.</em>";}
else if ($room=="") { else if ($room=="") {
if ($auth[0]==""){$prompt="";} // room not mandatory depending on setup
if (in_array("*:",$auth)||in_array($name.":",$auth)){$prompt="";}
else {$prompt="<em>Room missing.</em>";} else {$prompt="<em>Room missing.</em>";}
} }
else if (in_array($name.":".$room,$auth)) {$prompt="";} // here we have both room and user
else if (in_array(":".$room,$auth)) {$prompt="";} else if (in_array($name.":".$room,$auth)||in_array("*:".$room,$auth)||in_array($name.":*",$auth)||in_array("*:*",$auth)) {$prompt="";}
else if (in_array($name.":",$auth)) {$prompt="";}
else {$prompt="<em>User not authorized to this room.</em>";} else {$prompt="<em>User not authorized to this room.</em>";}
} }