Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sfu
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
Alain Takoudjou
sfu
Commits
78e9c96a
Commit
78e9c96a
authored
Sep 13, 2020
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make SetPermissions part of the client interface.
parent
0064aa6f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
14 deletions
+21
-14
client.go
client.go
+7
-0
disk.go
disk.go
+4
-0
group.go
group.go
+4
-12
webclient.go
webclient.go
+6
-2
No files found.
client.go
View file @
78e9c96a
...
...
@@ -5,10 +5,17 @@ type clientCredentials struct {
Password
string
`json:"password,omitempty"`
}
type
clientPermissions
struct
{
Op
bool
`json:"op,omitempty"`
Present
bool
`json:"present,omitempty"`
Record
bool
`json:"record,omitempty"`
}
type
client
interface
{
Group
()
*
group
Id
()
string
Credentials
()
clientCredentials
SetPermissions
(
clientPermissions
)
pushConn
(
id
string
,
conn
upConnection
,
tracks
[]
upTrack
,
label
string
)
error
pushClient
(
id
,
username
string
,
add
bool
)
error
}
...
...
disk.go
View file @
78e9c96a
...
...
@@ -36,6 +36,10 @@ func (client *diskClient) Credentials() clientCredentials {
return
clientCredentials
{
"RECORDING"
,
""
}
}
func
(
client
*
diskClient
)
SetPermissions
(
perms
clientPermissions
)
{
return
}
func
(
client
*
diskClient
)
pushClient
(
id
,
username
string
,
add
bool
)
error
{
return
nil
}
...
...
group.go
View file @
78e9c96a
...
...
@@ -190,10 +190,8 @@ func addClient(name string, c client) (*group, error) {
if
err
!=
nil
{
return
nil
,
err
}
w
,
ok
:=
c
.
(
*
webClient
)
if
ok
{
w
.
permissions
=
perms
}
c
.
SetPermissions
(
perms
)
if
!
perms
.
Op
&&
atomic
.
LoadUint32
(
&
g
.
locked
)
!=
0
{
return
nil
,
userError
(
"group is locked"
)
...
...
@@ -396,14 +394,8 @@ func getDescription(name string) (*groupDescription, error) {
return
&
desc
,
nil
}
type
clientPermission
struct
{
Op
bool
`json:"op,omitempty"`
Present
bool
`json:"present,omitempty"`
Record
bool
`json:"record,omitempty"`
}
func
getPermission
(
desc
*
groupDescription
,
creds
clientCredentials
)
(
clientPermission
,
error
)
{
var
p
clientPermission
func
getPermission
(
desc
*
groupDescription
,
creds
clientCredentials
)
(
clientPermissions
,
error
)
{
var
p
clientPermissions
if
!
desc
.
AllowAnonymous
&&
creds
.
Username
==
""
{
return
p
,
userError
(
"anonymous users not allowed in this group, please choose a username"
)
}
...
...
webclient.go
View file @
78e9c96a
...
...
@@ -87,7 +87,7 @@ type webClient struct {
group
*
group
id
string
credentials
clientCredentials
permissions
clientPermission
permissions
clientPermission
s
requested
map
[
string
]
uint32
done
chan
struct
{}
writeCh
chan
interface
{}
...
...
@@ -111,6 +111,10 @@ func (c *webClient) Credentials() clientCredentials {
return
c
.
credentials
}
func
(
c
*
webClient
)
SetPermissions
(
perms
clientPermissions
)
{
c
.
permissions
=
perms
}
func
(
c
*
webClient
)
pushClient
(
id
,
username
string
,
add
bool
)
error
{
kind
:=
"add"
if
!
add
{
...
...
@@ -177,7 +181,7 @@ type clientMessage struct {
Id
string
`json:"id,omitempty"`
Username
string
`json:"username,omitempty"`
Password
string
`json:"password,omitempty"`
Permissions
clientPermission
`json:"permissions,omitempty"`
Permissions
clientPermission
s
`json:"permissions,omitempty"`
Group
string
`json:"group,omitempty"`
Value
string
`json:"value,omitempty"`
Offer
*
webrtc
.
SessionDescription
`json:"offer,omitempty"`
...
...
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