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
de0c42fa
Commit
de0c42fa
authored
Mar 03, 2024
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement "expires" and "not-before" for groups.
parent
4fe31b48
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
README
README
+2
-0
group/description.go
group/description.go
+6
-0
group/group.go
group/group.go
+16
-0
No files found.
README
View file @
de0c42fa
...
...
@@ -157,6 +157,8 @@ nobody will be able to join the group. The following fields are allowed:
a time;
- `max-history-age`: the time, in seconds, during which chat history is
kept (default 14400, i.e. 4 hours);
- `not-before` and `expires`: the times (in ISO 8601 or RFC 3339 format)
between which joining the group is allowed;
- `allow-recording`: if true, then recording is allowed in this group;
- `unrestricted-tokens`: if true, then ordinary users (without the "op"
privilege) are allowed to create tokens;
...
...
group/description.go
View file @
de0c42fa
...
...
@@ -46,6 +46,12 @@ type Description struct {
// The time for which history entries are kept.
MaxHistoryAge
int
`json:"max-history-age,omitempty"`
// Time after which joining is no longer allowed
Expires
*
time
.
Time
`json:"expires"`
// Time before which joining is not allowed
NotBefore
*
time
.
Time
`json:"not-before,omitempty"`
// Whether users are allowed to log in with an empty username.
AllowAnonymous
bool
`json:"allow-anonymous,omitempty"`
...
...
group/group.go
View file @
de0c42fa
...
...
@@ -607,6 +607,22 @@ func AddClient(group string, c Client, creds ClientCredentials) (*Group, error)
}
return
nil
,
UserError
(
m
)
}
if
g
.
description
.
NotBefore
!=
nil
||
g
.
description
.
Expires
!=
nil
{
now
:=
time
.
Now
()
if
g
.
description
.
NotBefore
!=
nil
&&
g
.
description
.
NotBefore
.
After
(
now
)
{
return
nil
,
UserError
(
"this group is not open yet"
,
)
}
if
g
.
description
.
Expires
!=
nil
&&
g
.
description
.
Expires
.
Before
(
now
)
{
return
nil
,
UserError
(
"this group is closed"
,
)
}
}
if
g
.
description
.
Autokick
{
ops
:=
false
for
_
,
c
:=
range
clients
{
...
...
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