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:
parent
7ed567ad0a
commit
48a4db3f85
3 changed files with 16 additions and 13 deletions
13
README.md
13
README.md
|
@ -21,12 +21,13 @@ Download, unzip and just copy the content of the `sources` folder to any folder
|
|||
## 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.
|
||||
|
||||
In this example `auth = John:Game,Mary:Game,John:Family,Tim:Family,admin:,:Public`,
|
||||
- John can access the Game room, the Family room and the Public room
|
||||
- Mary can access the Game room and the Public room
|
||||
- Tim can access the Family room and the Public room
|
||||
- admin can access all rooms
|
||||
- other users can only acccess the Public room
|
||||
In this example `auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Public,*:`,
|
||||
- `John:Game,John:Family' = John can access the Game room, the Family room and the Public room
|
||||
- `Mary:Game' = Mary can access the Game room and the Public room
|
||||
- `Tim:Family' = Tim can access the Family room and the Public room
|
||||
- `admin:*' = admin can access all rooms
|
||||
- `*:Public' = everybody can only acccess the Public room
|
||||
- `*:' = everybody can access the unnamed room
|
||||
|
||||
## Screen shot
|
||||
![screenshot](https://raw.githubusercontent.com/chtixof/databank/master/minchat_ynh/minchat_ynh_screenshot01.gif)
|
||||
|
|
|
@ -6,6 +6,7 @@ interval = 2500 ; milliseconds
|
|||
; :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
|
||||
; default = single unnamed room and free user names
|
||||
auth=*:
|
||||
; Example:
|
||||
;auth = John:Game,Mary:Game,John:Family,Tim:Family,admin:,:Public
|
||||
;auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Public,*:
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ function deleteOldHistory() {
|
|||
// init setup.ini parms
|
||||
$ini = parse_ini_file('conf/setup.ini');
|
||||
$interval= getarr($ini,'interval',2500);
|
||||
$auth= explode(',',getarr($ini,'auth',''));
|
||||
$auth= explode(',',getarr($ini,'auth','*:'));
|
||||
|
||||
// read args
|
||||
$name="";
|
||||
|
@ -35,14 +35,15 @@ if ($name.$room=="") {
|
|||
// no args
|
||||
$prompt = "Please fill in the form to continue:";
|
||||
} else {
|
||||
// user name mandatory in any case
|
||||
if ($name=="") {$prompt = "<em>User name missing.</em>";}
|
||||
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 if (in_array($name.":".$room,$auth)) {$prompt="";}
|
||||
else if (in_array(":".$room,$auth)) {$prompt="";}
|
||||
else if (in_array($name.":",$auth)) {$prompt="";}
|
||||
}
|
||||
// here we have both room and user
|
||||
else if (in_array($name.":".$room,$auth)||in_array("*:".$room,$auth)||in_array($name.":*",$auth)||in_array("*:*",$auth)) {$prompt="";}
|
||||
else {$prompt="<em>User not authorized to this room.</em>";}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue