Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
2f075639
Unverified
Commit
2f075639
authored
Dec 07, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#12580
parent
2be92150
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
24 deletions
+14
-24
src/main/java/org/b3log/solo/processor/console/CategoryConsole.java
...ava/org/b3log/solo/processor/console/CategoryConsole.java
+5
-9
src/main/java/org/b3log/solo/processor/console/CommentConsole.java
...java/org/b3log/solo/processor/console/CommentConsole.java
+4
-5
src/main/java/org/b3log/solo/processor/console/LinkConsole.java
...in/java/org/b3log/solo/processor/console/LinkConsole.java
+5
-10
No files found.
src/main/java/org/b3log/solo/processor/console/CategoryConsole.java
View file @
2f075639
...
@@ -57,7 +57,7 @@ import java.util.Set;
...
@@ -57,7 +57,7 @@ import java.util.Set;
* @since 2.0.0
* @since 2.0.0
*/
*/
@RequestProcessor
@RequestProcessor
@Before
(
ConsoleAdminAuthAdvice
.
class
)
@Before
(
ConsoleAdminAuthAdvice
.
class
)
public
class
CategoryConsole
{
public
class
CategoryConsole
{
/**
/**
...
@@ -159,15 +159,12 @@ public class CategoryConsole {
...
@@ -159,15 +159,12 @@ public class CategoryConsole {
* @param context the specified http request context
* @param context the specified http request context
* @throws Exception exception
* @throws Exception exception
*/
*/
@RequestProcessing
(
value
=
"/console/category/
*
"
,
method
=
HttpMethod
.
GET
)
@RequestProcessing
(
value
=
"/console/category/
{id}
"
,
method
=
HttpMethod
.
GET
)
public
void
getCategory
(
final
RequestContext
context
)
{
public
void
getCategory
(
final
RequestContext
context
)
{
final
JsonRenderer
renderer
=
new
JsonRenderer
();
final
JsonRenderer
renderer
=
new
JsonRenderer
();
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
try
{
try
{
final
HttpServletRequest
request
=
context
.
getRequest
();
final
String
categoryId
=
context
.
pathVar
(
"id"
);
final
String
requestURI
=
request
.
getRequestURI
();
final
String
categoryId
=
requestURI
.
substring
((
Latkes
.
getContextPath
()
+
"/console/category/"
).
length
());
final
JSONObject
result
=
categoryQueryService
.
getCategory
(
categoryId
);
final
JSONObject
result
=
categoryQueryService
.
getCategory
(
categoryId
);
if
(
null
==
result
)
{
if
(
null
==
result
)
{
renderer
.
setJSONObject
(
new
JSONObject
().
put
(
Keys
.
STATUS_CODE
,
false
));
renderer
.
setJSONObject
(
new
JSONObject
().
put
(
Keys
.
STATUS_CODE
,
false
));
...
@@ -209,15 +206,14 @@ public class CategoryConsole {
...
@@ -209,15 +206,14 @@ public class CategoryConsole {
* @param context the specified http request context
* @param context the specified http request context
* @throws Exception exception
* @throws Exception exception
*/
*/
@RequestProcessing
(
value
=
"/console/category/
*
"
,
method
=
HttpMethod
.
DELETE
)
@RequestProcessing
(
value
=
"/console/category/
{id}
"
,
method
=
HttpMethod
.
DELETE
)
public
void
removeCategory
(
final
RequestContext
context
)
{
public
void
removeCategory
(
final
RequestContext
context
)
{
final
JsonRenderer
renderer
=
new
JsonRenderer
();
final
JsonRenderer
renderer
=
new
JsonRenderer
();
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
final
JSONObject
jsonObject
=
new
JSONObject
();
final
JSONObject
jsonObject
=
new
JSONObject
();
renderer
.
setJSONObject
(
jsonObject
);
renderer
.
setJSONObject
(
jsonObject
);
try
{
try
{
final
HttpServletRequest
request
=
context
.
getRequest
();
final
String
categoryId
=
context
.
pathVar
(
"id"
);
final
String
categoryId
=
request
.
getRequestURI
().
substring
((
Latkes
.
getContextPath
()
+
"/console/category/"
).
length
());
categoryMgmtService
.
removeCategory
(
categoryId
);
categoryMgmtService
.
removeCategory
(
categoryId
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
true
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
true
);
...
...
src/main/java/org/b3log/solo/processor/console/CommentConsole.java
View file @
2f075639
...
@@ -87,7 +87,7 @@ public class CommentConsole {
...
@@ -87,7 +87,7 @@ public class CommentConsole {
*
*
* @param context the specified http request context
* @param context the specified http request context
*/
*/
@RequestProcessing
(
value
=
"/console/page/comment/
*
"
,
method
=
HttpMethod
.
DELETE
)
@RequestProcessing
(
value
=
"/console/page/comment/
{id}
"
,
method
=
HttpMethod
.
DELETE
)
public
void
removePageComment
(
final
RequestContext
context
)
{
public
void
removePageComment
(
final
RequestContext
context
)
{
final
JsonRenderer
renderer
=
new
JsonRenderer
();
final
JsonRenderer
renderer
=
new
JsonRenderer
();
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
...
@@ -97,8 +97,7 @@ public class CommentConsole {
...
@@ -97,8 +97,7 @@ public class CommentConsole {
try
{
try
{
final
HttpServletRequest
request
=
context
.
getRequest
();
final
HttpServletRequest
request
=
context
.
getRequest
();
final
HttpServletResponse
response
=
context
.
getResponse
();
final
HttpServletResponse
response
=
context
.
getResponse
();
final
String
commentId
=
request
.
getRequestURI
().
substring
((
Latkes
.
getContextPath
()
+
"/console/page/comment/"
).
length
());
final
String
commentId
=
context
.
pathVar
(
"id"
);
final
JSONObject
currentUser
=
Solos
.
getCurrentUser
(
request
,
response
);
final
JSONObject
currentUser
=
Solos
.
getCurrentUser
(
request
,
response
);
if
(!
commentQueryService
.
canAccessComment
(
commentId
,
currentUser
))
{
if
(!
commentQueryService
.
canAccessComment
(
commentId
,
currentUser
))
{
ret
.
put
(
Keys
.
STATUS_CODE
,
false
);
ret
.
put
(
Keys
.
STATUS_CODE
,
false
);
...
@@ -133,7 +132,7 @@ public class CommentConsole {
...
@@ -133,7 +132,7 @@ public class CommentConsole {
*
*
* @param context the specified http request context
* @param context the specified http request context
*/
*/
@RequestProcessing
(
value
=
"/console/article/comment/
*
"
,
method
=
HttpMethod
.
DELETE
)
@RequestProcessing
(
value
=
"/console/article/comment/
{id}
"
,
method
=
HttpMethod
.
DELETE
)
public
void
removeArticleComment
(
final
RequestContext
context
)
{
public
void
removeArticleComment
(
final
RequestContext
context
)
{
final
JsonRenderer
renderer
=
new
JsonRenderer
();
final
JsonRenderer
renderer
=
new
JsonRenderer
();
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
...
@@ -143,7 +142,7 @@ public class CommentConsole {
...
@@ -143,7 +142,7 @@ public class CommentConsole {
try
{
try
{
final
HttpServletRequest
request
=
context
.
getRequest
();
final
HttpServletRequest
request
=
context
.
getRequest
();
final
HttpServletResponse
response
=
context
.
getResponse
();
final
HttpServletResponse
response
=
context
.
getResponse
();
final
String
commentId
=
request
.
getRequestURI
().
substring
((
Latkes
.
getContextPath
()
+
"/console/article/comment/"
).
length
()
);
final
String
commentId
=
context
.
pathVar
(
"id"
);
final
JSONObject
currentUser
=
Solos
.
getCurrentUser
(
request
,
response
);
final
JSONObject
currentUser
=
Solos
.
getCurrentUser
(
request
,
response
);
if
(!
commentQueryService
.
canAccessComment
(
commentId
,
currentUser
))
{
if
(!
commentQueryService
.
canAccessComment
(
commentId
,
currentUser
))
{
ret
.
put
(
Keys
.
STATUS_CODE
,
false
);
ret
.
put
(
Keys
.
STATUS_CODE
,
false
);
...
...
src/main/java/org/b3log/solo/processor/console/LinkConsole.java
View file @
2f075639
...
@@ -48,7 +48,7 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -48,7 +48,7 @@ import javax.servlet.http.HttpServletRequest;
* @since 0.4.0
* @since 0.4.0
*/
*/
@RequestProcessor
@RequestProcessor
@Before
(
ConsoleAdminAuthAdvice
.
class
)
@Before
(
ConsoleAdminAuthAdvice
.
class
)
public
class
LinkConsole
{
public
class
LinkConsole
{
/**
/**
...
@@ -88,7 +88,7 @@ public class LinkConsole {
...
@@ -88,7 +88,7 @@ public class LinkConsole {
*
*
* @param context the specified http request context
* @param context the specified http request context
*/
*/
@RequestProcessing
(
value
=
"/console/link/
*
"
,
method
=
HttpMethod
.
DELETE
)
@RequestProcessing
(
value
=
"/console/link/
{id}
"
,
method
=
HttpMethod
.
DELETE
)
public
void
removeLink
(
final
RequestContext
context
)
{
public
void
removeLink
(
final
RequestContext
context
)
{
final
JsonRenderer
renderer
=
new
JsonRenderer
();
final
JsonRenderer
renderer
=
new
JsonRenderer
();
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
...
@@ -96,9 +96,7 @@ public class LinkConsole {
...
@@ -96,9 +96,7 @@ public class LinkConsole {
renderer
.
setJSONObject
(
jsonObject
);
renderer
.
setJSONObject
(
jsonObject
);
try
{
try
{
final
HttpServletRequest
request
=
context
.
getRequest
();
final
String
linkId
=
context
.
pathVar
(
"id"
);
final
String
linkId
=
request
.
getRequestURI
().
substring
((
Latkes
.
getContextPath
()
+
"/console/link/"
).
length
());
linkMgmtService
.
removeLink
(
linkId
);
linkMgmtService
.
removeLink
(
linkId
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
true
);
jsonObject
.
put
(
Keys
.
STATUS_CODE
,
true
);
...
@@ -336,16 +334,13 @@ public class LinkConsole {
...
@@ -336,16 +334,13 @@ public class LinkConsole {
*
*
* @param context the specified http request context
* @param context the specified http request context
*/
*/
@RequestProcessing
(
value
=
"/console/link/
*
"
,
method
=
HttpMethod
.
GET
)
@RequestProcessing
(
value
=
"/console/link/
{id}
"
,
method
=
HttpMethod
.
GET
)
public
void
getLink
(
final
RequestContext
context
)
{
public
void
getLink
(
final
RequestContext
context
)
{
final
JsonRenderer
renderer
=
new
JsonRenderer
();
final
JsonRenderer
renderer
=
new
JsonRenderer
();
context
.
setRenderer
(
renderer
);
context
.
setRenderer
(
renderer
);
try
{
try
{
final
HttpServletRequest
request
=
context
.
getRequest
();
final
String
linkId
=
context
.
pathVar
(
"id"
);
final
String
requestURI
=
request
.
getRequestURI
();
final
String
linkId
=
requestURI
.
substring
((
Latkes
.
getContextPath
()
+
"/console/link/"
).
length
());
final
JSONObject
result
=
linkQueryService
.
getLink
(
linkId
);
final
JSONObject
result
=
linkQueryService
.
getLink
(
linkId
);
if
(
null
==
result
)
{
if
(
null
==
result
)
{
renderer
.
setJSONObject
(
new
JSONObject
().
put
(
Keys
.
STATUS_CODE
,
false
));
renderer
.
setJSONObject
(
new
JSONObject
().
put
(
Keys
.
STATUS_CODE
,
false
));
...
...
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