| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 13b3e0a commit c679ffd
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -539,6 +539,16 @@ public double doubleValue(@NotNull JSONObject request, String value) { | |||
| 539 | 539 | } | |
| 540 | 540 | //获取非基本类型对应基本类型的非空值 >>>>>>>>>>>>>>>>>>>>>>>>>>>>> | |
| 541 | 541 | ||
| 542 | + /**获取value,当value为null时获取defaultValue | ||
| 543 | + * @param request | ||
| 544 | + * @param value | ||
| 545 | + * @param defaultValue | ||
| 546 | + * @return v == null ? request.get(defaultValue) : v | ||
| 547 | + */ | ||
| 548 | + public Object getWithDefault(@NotNull JSONObject request, String value, String defaultValue) { | ||
| 549 | + Object v = request.get(value); | ||
| 550 | + return v == null ? request.get(defaultValue) : v; | ||
| 551 | + } | ||
| 542 | 552 | ||
| 543 | 553 | ||
| 544 | 554 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,6 +42,7 @@ | |||
| 42 | 42 | import zuo.biao.apijson.StringUtil; | |
| 43 | 43 | import zuo.biao.apijson.server.exception.ConflictException; | |
| 44 | 44 | import zuo.biao.apijson.server.exception.NotLoggedInException; | |
| 45 | + import zuo.biao.apijson.server.model.Access; | ||
| 45 | 46 | import zuo.biao.apijson.server.model.Column; | |
| 46 | 47 | import zuo.biao.apijson.server.model.Document; | |
| 47 | 48 | import zuo.biao.apijson.server.model.Function; | |
@@ -72,6 +73,7 @@ public abstract class AbstractVerifier implements Verifier { | |||
| 72 | 73 | ACCESS_MAP.put(Document.class.getSimpleName(), getAccessMap(Document.class.getAnnotation(MethodAccess.class))); | |
| 73 | 74 | ACCESS_MAP.put(TestRecord.class.getSimpleName(), getAccessMap(TestRecord.class.getAnnotation(MethodAccess.class))); | |
| 74 | 75 | ACCESS_MAP.put(Function.class.getSimpleName(), getAccessMap(Function.class.getAnnotation(MethodAccess.class))); | |
| 76 | + ACCESS_MAP.put(Access.class.getSimpleName(), getAccessMap(Access.class.getAnnotation(MethodAccess.class))); | ||
| 75 | 77 | } | |
| 76 | 78 | ||
| 77 | 79 | /**获取权限Map,每种操作都只允许对应的角色 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,24 @@ | |||
| 1 | + /*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON) | ||
| 2 | + | ||
| 3 | + Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | + you may not use this file except in compliance with the License. | ||
| 5 | + You may obtain a copy of the License at | ||
| 6 | + | ||
| 7 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | + | ||
| 9 | + Unless required by applicable law or agreed to in writing, software | ||
| 10 | + distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | + See the License for the specific language governing permissions and | ||
| 13 | + limitations under the License.*/ | ||
| 14 | + | ||
| 15 | + package zuo.biao.apijson.server.model; | ||
| 16 | + | ||
| 17 | + import zuo.biao.apijson.MethodAccess; | ||
| 18 | + | ||
| 19 | + /**访问权限 | ||
| 20 | + * @author Lemon | ||
| 21 | + */ | ||
| 22 | + @MethodAccess(POST = {}, PUT = {}, DELETE = {}) | ||
| 23 | + public class Access { | ||
| 24 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments