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
6098d4af
Commit
6098d4af
authored
Jan 14, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement autolock.
parent
bd287dbb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
18 deletions
+48
-18
README
README
+2
-0
diskwriter/diskwriter.go
diskwriter/diskwriter.go
+4
-0
group/client.go
group/client.go
+1
-0
group/group.go
group/group.go
+37
-18
rtpconn/webclient.go
rtpconn/webclient.go
+4
-0
No files found.
README
View file @
6098d4af
...
@@ -235,6 +235,8 @@ the group.
...
@@ -235,6 +235,8 @@ the group.
- `allow-anonymous`: if true, then users may connect with an empty username;
- `allow-anonymous`: if true, then users may connect with an empty username;
- `allow-subgroups`: if true, then subgroups of the form `group/subgroup`
- `allow-subgroups`: if true, then subgroups of the form `group/subgroup`
are automatically created when first accessed;
are automatically created when first accessed;
- `autolock`: if true, the group will start locked and become locked
whenever there are no clients with operator privileges;
- `redirect`: if set, then attempts to join the group will be redirected
- `redirect`: if set, then attempts to join the group will be redirected
to the given URL; most other fields are ignored in this case;
to the given URL; most other fields are ignored in this case;
- `codecs`: this is a list of codecs allowed in this group. The default
- `codecs`: this is a list of codecs allowed in this group. The default
...
...
diskwriter/diskwriter.go
View file @
6098d4af
...
@@ -67,6 +67,10 @@ func (client *Client) SetPermissions(perms group.ClientPermissions) {
...
@@ -67,6 +67,10 @@ func (client *Client) SetPermissions(perms group.ClientPermissions) {
return
return
}
}
func
(
client
*
Client
)
Permissions
()
group
.
ClientPermissions
{
return
group
.
ClientPermissions
{}
}
func
(
client
*
Client
)
PushClient
(
id
,
username
string
,
add
bool
)
error
{
func
(
client
*
Client
)
PushClient
(
id
,
username
string
,
add
bool
)
error
{
return
nil
return
nil
}
}
...
...
group/client.go
View file @
6098d4af
...
@@ -96,6 +96,7 @@ type Client interface {
...
@@ -96,6 +96,7 @@ type Client interface {
Group
()
*
Group
Group
()
*
Group
Id
()
string
Id
()
string
Challengeable
Challengeable
Permissions
()
ClientPermissions
SetPermissions
(
ClientPermissions
)
SetPermissions
(
ClientPermissions
)
OverridePermissions
(
*
Group
)
bool
OverridePermissions
(
*
Group
)
bool
PushConn
(
g
*
Group
,
id
string
,
conn
conn
.
Up
,
tracks
[]
conn
.
UpTrack
)
error
PushConn
(
g
*
Group
,
id
string
,
conn
conn
.
Up
,
tracks
[]
conn
.
UpTrack
)
error
...
...
group/group.go
View file @
6098d4af
...
@@ -293,6 +293,7 @@ func Add(name string, desc *description) (*Group, error) {
...
@@ -293,6 +293,7 @@ func Add(name string, desc *description) (*Group, error) {
timestamp
:
time
.
Now
(),
timestamp
:
time
.
Now
(),
api
:
APIFromNames
(
desc
.
Codecs
),
api
:
APIFromNames
(
desc
.
Codecs
),
}
}
autolock
(
g
,
g
.
getClientsUnlocked
(
nil
))
groups
.
groups
[
name
]
=
g
groups
.
groups
[
name
]
=
g
return
g
,
nil
return
g
,
nil
}
}
...
@@ -302,27 +303,24 @@ func Add(name string, desc *description) (*Group, error) {
...
@@ -302,27 +303,24 @@ func Add(name string, desc *description) (*Group, error) {
if
desc
!=
nil
{
if
desc
!=
nil
{
g
.
description
=
desc
g
.
description
=
desc
g
.
api
=
APIFromNames
(
desc
.
Codecs
)
}
else
if
time
.
Since
(
g
.
description
.
loadTime
)
<
5
*
time
.
Second
{
return
g
,
nil
}
else
if
!
descriptionChanged
(
name
,
g
.
description
)
{
g
.
description
.
loadTime
=
time
.
Now
()
return
g
,
nil
return
g
,
nil
}
}
if
time
.
Since
(
g
.
description
.
loadTime
)
>
5
*
time
.
Second
{
desc
,
err
=
GetDescription
(
name
)
if
descriptionChanged
(
name
,
g
.
description
)
{
if
err
!=
nil
{
desc
,
err
:=
GetDescription
(
name
)
if
!
os
.
IsNotExist
(
err
)
{
if
err
!=
nil
{
log
.
Printf
(
"Reading group %v: %v"
,
name
,
err
)
if
!
os
.
IsNotExist
(
err
)
{
log
.
Printf
(
"Reading group %v: %v"
,
name
,
err
)
}
deleteUnlocked
(
g
)
return
nil
,
err
}
g
.
description
=
desc
g
.
api
=
APIFromNames
(
desc
.
Codecs
)
}
else
{
g
.
description
.
loadTime
=
time
.
Now
()
}
}
deleteUnlocked
(
g
)
return
nil
,
err
}
}
g
.
description
=
desc
g
.
api
=
APIFromNames
(
desc
.
Codecs
)
autolock
(
g
,
g
.
getClientsUnlocked
(
nil
))
return
g
,
nil
return
g
,
nil
}
}
...
@@ -451,7 +449,7 @@ func AddClient(group string, c Client) (*Group, error) {
...
@@ -451,7 +449,7 @@ func AddClient(group string, c Client) (*Group, error) {
if
!
perms
.
Op
&&
g
.
locked
!=
nil
{
if
!
perms
.
Op
&&
g
.
locked
!=
nil
{
m
:=
*
g
.
locked
m
:=
*
g
.
locked
if
m
==
""
{
if
m
==
""
{
m
=
"group is locked"
m
=
"
this
group is locked"
}
}
return
nil
,
UserError
(
m
)
return
nil
,
UserError
(
m
)
}
}
...
@@ -483,6 +481,22 @@ func AddClient(group string, c Client) (*Group, error) {
...
@@ -483,6 +481,22 @@ func AddClient(group string, c Client) (*Group, error) {
return
g
,
nil
return
g
,
nil
}
}
// called locked
func
autolock
(
g
*
Group
,
clients
[]
Client
)
{
if
g
.
locked
==
nil
&&
g
.
description
.
Autolock
{
lock
:=
true
for
_
,
c
:=
range
clients
{
if
c
.
Permissions
()
.
Op
{
lock
=
false
}
}
if
lock
{
m
:=
"this group is locked"
g
.
locked
=
&
m
}
}
}
func
DelClient
(
c
Client
)
{
func
DelClient
(
c
Client
)
{
g
:=
c
.
Group
()
g
:=
c
.
Group
()
if
g
==
nil
{
if
g
==
nil
{
...
@@ -498,11 +512,15 @@ func DelClient(c Client) {
...
@@ -498,11 +512,15 @@ func DelClient(c Client) {
delete
(
g
.
clients
,
c
.
Id
())
delete
(
g
.
clients
,
c
.
Id
())
g
.
timestamp
=
time
.
Now
()
g
.
timestamp
=
time
.
Now
()
clients
:=
g
.
getClientsUnlocked
(
nil
)
go
func
(
clients
[]
Client
)
{
go
func
(
clients
[]
Client
)
{
for
_
,
cc
:=
range
clients
{
for
_
,
cc
:=
range
clients
{
cc
.
PushClient
(
c
.
Id
(),
c
.
Username
(),
false
)
cc
.
PushClient
(
c
.
Id
(),
c
.
Username
(),
false
)
}
}
}(
g
.
getClientsUnlocked
(
nil
))
}(
clients
)
autolock
(
g
,
clients
)
}
}
func
(
g
*
Group
)
GetClients
(
except
Client
)
[]
Client
{
func
(
g
*
Group
)
GetClients
(
except
Client
)
[]
Client
{
...
@@ -668,6 +686,7 @@ type description struct {
...
@@ -668,6 +686,7 @@ type description struct {
AllowAnonymous
bool
`json:"allow-anonymous,omitempty"`
AllowAnonymous
bool
`json:"allow-anonymous,omitempty"`
AllowRecording
bool
`json:"allow-recording,omitempty"`
AllowRecording
bool
`json:"allow-recording,omitempty"`
AllowSubgroups
bool
`json:"allow-subgroups,omitempty"`
AllowSubgroups
bool
`json:"allow-subgroups,omitempty"`
Autolock
bool
`json:"autolock,omitempty"`
Op
[]
ClientCredentials
`json:"op,omitempty"`
Op
[]
ClientCredentials
`json:"op,omitempty"`
Presenter
[]
ClientCredentials
`json:"presenter,omitempty"`
Presenter
[]
ClientCredentials
`json:"presenter,omitempty"`
Other
[]
ClientCredentials
`json:"other,omitempty"`
Other
[]
ClientCredentials
`json:"other,omitempty"`
...
...
rtpconn/webclient.go
View file @
6098d4af
...
@@ -93,6 +93,10 @@ func (c *webClient) Challenge(group string, creds group.ClientCredentials) bool
...
@@ -93,6 +93,10 @@ func (c *webClient) Challenge(group string, creds group.ClientCredentials) bool
return
m
return
m
}
}
func
(
c
*
webClient
)
Permissions
()
group
.
ClientPermissions
{
return
c
.
permissions
}
func
(
c
*
webClient
)
SetPermissions
(
perms
group
.
ClientPermissions
)
{
func
(
c
*
webClient
)
SetPermissions
(
perms
group
.
ClientPermissions
)
{
c
.
permissions
=
perms
c
.
permissions
=
perms
}
}
...
...
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