Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
6b68ab94
Commit
6b68ab94
authored
8 years ago
by
Gabriel Engel
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #4660 from bnagydeveloper/develop
Added room archive and unarchive api endpoints
parents
9767726f
b17cddba
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/restapi/restapi.coffee
+36
-0
36 additions, 0 deletions
server/restapi/restapi.coffee
with
36 additions
and
0 deletions
server/restapi/restapi.coffee
+
36
−
0
View file @
6b68ab94
...
@@ -240,3 +240,39 @@ Api.addRoute 'bulk/createRoom', authRequired: true,
...
@@ -240,3 +240,39 @@ Api.addRoute 'bulk/createRoom', authRequired: true,
console
.
log
'[restapi] bulk/createRoom -> '
.
red
,
"User does not have 'bulk-create-c' permission"
console
.
log
'[restapi] bulk/createRoom -> '
.
red
,
"User does not have 'bulk-create-c' permission"
statusCode
:
403
statusCode
:
403
body
:
status
:
'error'
,
message
:
'You do not have permission to do this'
body
:
status
:
'error'
,
message
:
'You do not have permission to do this'
# archive a room by it's ID
Api
.
addRoute
'room/:id/archive'
,
authRequired
:
true
,
post
:
action
:
->
# user must also have archive-room permission
if
RocketChat
.
authz
.
hasPermission
(
@
userId
,
'archive-room'
)
try
Meteor
.
runAsUser
this
.
userId
,
()
=>
Meteor
.
call
(
'archiveRoom'
,
@
urlParams
.
id
)
status
:
'success'
# need to handle error
catch
e
statusCode
:
400
# bad request or other errors
body
:
status
:
'fail'
,
message
:
e
.
name
+
' :: '
+
e
.
message
else
console
.
log
'[restapi] archiveRoom -> '
.
red
,
"User does not have 'archive-room' permission"
statusCode
:
403
body
:
status
:
'error'
,
message
:
'You do not have permission to do this'
# unarchive a room by it's ID
Api
.
addRoute
'room/:id/unarchive'
,
authRequired
:
true
,
post
:
action
:
->
# user must also have unarchive-room permission
if
RocketChat
.
authz
.
hasPermission
(
@
userId
,
'unarchive-room'
)
try
Meteor
.
runAsUser
this
.
userId
,
()
=>
Meteor
.
call
(
'unarchiveRoom'
,
@
urlParams
.
id
)
status
:
'success'
# need to handle error
catch
e
statusCode
:
400
# bad request or other errors
body
:
status
:
'fail'
,
message
:
e
.
name
+
' :: '
+
e
.
message
else
console
.
log
'[restapi] unarchiveRoom -> '
.
red
,
"User does not have 'unarchive-room' permission"
statusCode
:
403
body
:
status
:
'error'
,
message
:
'You do not have permission to do this'
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment