Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
8bfdc2b0
Commit
8bfdc2b0
authored
Apr 25, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display username, rename admin to op.
parent
a45914fe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
11 deletions
+33
-11
client.go
client.go
+2
-2
group.go
group.go
+7
-7
static/sfu.html
static/sfu.html
+1
-0
static/sfu.js
static/sfu.js
+23
-2
No files found.
client.go
View file @
8bfdc2b0
...
...
@@ -794,7 +794,7 @@ func handleClientMessage(c *client, m clientMessage) error {
cc
.
write
(
m
)
}
case
"op"
,
"unop"
,
"present"
,
"unpresent"
:
if
!
c
.
permissions
.
Admin
{
if
!
c
.
permissions
.
Op
{
c
.
error
(
userError
(
"not authorised"
))
return
nil
}
...
...
@@ -803,7 +803,7 @@ func handleClientMessage(c *client, m clientMessage) error {
return
c
.
error
(
err
)
}
case
"kick"
:
if
!
c
.
permissions
.
Admin
{
if
!
c
.
permissions
.
Op
{
c
.
error
(
userError
(
"not authorised"
))
return
nil
}
...
...
group.go
View file @
8bfdc2b0
...
...
@@ -196,7 +196,7 @@ func addClient(name string, client *client, user, pass string) (*group, []userid
var
users
[]
userid
g
.
mu
.
Lock
()
defer
g
.
mu
.
Unlock
()
if
!
perms
.
Admin
&&
g
.
description
.
MaxClients
>
0
{
if
!
perms
.
Op
&&
g
.
description
.
MaxClients
>
0
{
if
len
(
g
.
clients
)
>=
g
.
description
.
MaxClients
{
return
nil
,
nil
,
userError
(
"too many users"
)
}
...
...
@@ -322,7 +322,7 @@ type groupDescription struct {
Public
bool
`json:"public,omitempty"`
MaxClients
int
`json:"max-clients,omitempty"`
AllowAnonymous
bool
`json:"allow-anonymous,omitempty"`
Admin
[]
groupUser
`json:"admin
,omitempty"`
Op
[]
groupUser
`json:"op
,omitempty"`
Presenter
[]
groupUser
`json:"presenter,omitempty"`
Other
[]
groupUser
`json:"other,omitempty"`
}
...
...
@@ -370,7 +370,7 @@ func getDescription(name string) (*groupDescription, error) {
}
type
userPermission
struct
{
Admin
bool
`json:"admin
,omitempty"`
Op
bool
`json:"op
,omitempty"`
Present
bool
`json:"present,omitempty"`
}
...
...
@@ -379,9 +379,9 @@ func getPermission(desc *groupDescription, user, pass string) (userPermission, e
if
!
desc
.
AllowAnonymous
&&
user
==
""
{
return
p
,
userError
(
"anonymous users not allowed in this group, please choose a username"
)
}
if
found
,
good
:=
matchUser
(
user
,
pass
,
desc
.
Admin
);
found
{
if
found
,
good
:=
matchUser
(
user
,
pass
,
desc
.
Op
);
found
{
if
good
{
p
.
Admin
=
true
p
.
Op
=
true
p
.
Present
=
true
return
p
,
nil
}
...
...
@@ -414,9 +414,9 @@ func setPermission(g *group, id string, perm string) error {
switch
perm
{
case
"op"
:
c
.
permissions
.
Admin
=
true
c
.
permissions
.
Op
=
true
case
"unop"
:
c
.
permissions
.
Admin
=
false
c
.
permissions
.
Op
=
false
case
"present"
:
c
.
permissions
.
Present
=
true
case
"unpresent"
:
...
...
static/sfu.html
View file @
8bfdc2b0
...
...
@@ -13,6 +13,7 @@
<div
id=
"header"
>
<div
id=
"statdiv"
>
<span
id=
"statspan"
></span>
<span
id=
"userspan"
></span>
<form
id=
"userform"
class=
"userform"
>
<label
for=
"username"
>
Username:
</label>
<input
id=
"username"
type=
"text"
name=
"username"
...
...
static/sfu.js
View file @
8bfdc2b0
...
...
@@ -83,6 +83,7 @@ function setConnected(connected) {
userform
.
classList
.
add
(
'
userform-invisible
'
);
userform
.
classList
.
remove
(
'
userform
'
);
disconnectbutton
.
classList
.
remove
(
'
disconnect-invisible
'
);
displayUsername
();
}
else
{
let
userpass
=
getUserPass
();
document
.
getElementById
(
'
username
'
).
value
=
...
...
@@ -96,6 +97,7 @@ function setConnected(connected) {
userform
.
classList
.
remove
(
'
userform-invisible
'
);
disconnectbutton
.
classList
.
add
(
'
disconnect-invisible
'
);
permissions
=
{};
clearUsername
(
false
);
}
}
...
...
@@ -518,10 +520,29 @@ function gotUser(id, name, del) {
addUser
(
id
,
name
);
}
function
displayUsername
()
{
let
userpass
=
getUserPass
();
let
text
=
''
;
if
(
userpass
&&
userpass
.
username
)
text
=
'
as
'
+
userpass
.
username
;
if
(
permissions
.
op
&&
permissions
.
present
)
text
=
text
+
'
(op, presenter)
'
;
else
if
(
permissions
.
op
)
text
=
text
+
'
(op)
'
;
else
if
(
permissions
.
present
)
text
=
text
+
'
(presenter)
'
;
document
.
getElementById
(
'
userspan
'
).
textContent
=
text
;
}
function
clearUsername
()
{
document
.
getElementById
(
'
userspan
'
).
textContent
=
''
;
}
function
gotPermissions
(
perm
)
{
permissions
=
perm
;
document
.
getElementById
(
'
presenterbox
'
).
disabled
=
!
perm
.
present
;
document
.
getElementById
(
'
sharebox
'
).
disabled
=
!
perm
.
present
;
displayUsername
();
}
const
urlRegexp
=
/https
?
:
\/\/[
-a-zA-Z0-9@:%
/
._
\+
~#=?
]
+
[
-a-zA-Z0-9@:%
/
_
\+
~#=
]
/g
;
...
...
@@ -647,8 +668,8 @@ function handleInput() {
case
'
/kick
'
:
case
'
/present
'
:
case
'
/unpresent
'
:
if
(
!
permissions
.
admin
)
{
displayError
(
"
You're not an
administ
rator
"
);
if
(
!
permissions
.
op
)
{
displayError
(
"
You're not an
ope
rator
"
);
return
;
}
let
id
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment