Showing
6 changed files
with
8 additions
and
8 deletions
... | ... | @@ -135,7 +135,7 @@ public class UserController extends BaseController { |
135 | 135 | HttpServletRequest request) throws ThingsboardException { |
136 | 136 | try { |
137 | 137 | |
138 | - if (getCurrentUser().getAuthority() == Authority.TENANT_ADMIN) { | |
138 | + if (Authority.TENANT_ADMIN.equals(getCurrentUser().getAuthority())) { | |
139 | 139 | user.setTenantId(getCurrentUser().getTenantId()); |
140 | 140 | } |
141 | 141 | ... | ... |
... | ... | @@ -60,7 +60,7 @@ public class WidgetTypeController extends BaseController { |
60 | 60 | @ResponseBody |
61 | 61 | public WidgetType saveWidgetType(@RequestBody WidgetType widgetType) throws ThingsboardException { |
62 | 62 | try { |
63 | - if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) { | |
63 | + if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) { | |
64 | 64 | widgetType.setTenantId(TenantId.SYS_TENANT_ID); |
65 | 65 | } else { |
66 | 66 | widgetType.setTenantId(getCurrentUser().getTenantId()); | ... | ... |
... | ... | @@ -61,7 +61,7 @@ public class WidgetsBundleController extends BaseController { |
61 | 61 | @ResponseBody |
62 | 62 | public WidgetsBundle saveWidgetsBundle(@RequestBody WidgetsBundle widgetsBundle) throws ThingsboardException { |
63 | 63 | try { |
64 | - if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) { | |
64 | + if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) { | |
65 | 65 | widgetsBundle.setTenantId(TenantId.SYS_TENANT_ID); |
66 | 66 | } else { |
67 | 67 | widgetsBundle.setTenantId(getCurrentUser().getTenantId()); |
... | ... | @@ -103,7 +103,7 @@ public class WidgetsBundleController extends BaseController { |
103 | 103 | @RequestParam(required = false) String sortOrder) throws ThingsboardException { |
104 | 104 | try { |
105 | 105 | PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder); |
106 | - if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) { | |
106 | + if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) { | |
107 | 107 | return checkNotNull(widgetsBundleService.findSystemWidgetsBundlesByPageLink(getTenantId(), pageLink)); |
108 | 108 | } else { |
109 | 109 | TenantId tenantId = getCurrentUser().getTenantId(); |
... | ... | @@ -119,7 +119,7 @@ public class WidgetsBundleController extends BaseController { |
119 | 119 | @ResponseBody |
120 | 120 | public List<WidgetsBundle> getWidgetsBundles() throws ThingsboardException { |
121 | 121 | try { |
122 | - if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) { | |
122 | + if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) { | |
123 | 123 | return checkNotNull(widgetsBundleService.findSystemWidgetsBundles(getTenantId())); |
124 | 124 | } else { |
125 | 125 | TenantId tenantId = getCurrentUser().getTenantId(); | ... | ... |
... | ... | @@ -105,7 +105,7 @@ public class CustomerUserPermissions extends AbstractPermissions { |
105 | 105 | |
106 | 106 | @Override |
107 | 107 | public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) { |
108 | - if (userEntity.getAuthority() != Authority.CUSTOMER_USER) { | |
108 | + if (!Authority.CUSTOMER_USER.equals(userEntity.getAuthority())) { | |
109 | 109 | return false; |
110 | 110 | } |
111 | 111 | if (!user.getId().equals(userId)) { | ... | ... |
... | ... | @@ -57,7 +57,7 @@ public class SysAdminPermissions extends AbstractPermissions { |
57 | 57 | |
58 | 58 | @Override |
59 | 59 | public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) { |
60 | - if (userEntity.getAuthority() == Authority.CUSTOMER_USER) { | |
60 | + if (Authority.CUSTOMER_USER.equals(userEntity.getAuthority())) { | |
61 | 61 | return false; |
62 | 62 | } |
63 | 63 | return true; | ... | ... |
... | ... | @@ -76,7 +76,7 @@ public class TenantAdminPermissions extends AbstractPermissions { |
76 | 76 | |
77 | 77 | @Override |
78 | 78 | public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) { |
79 | - if (userEntity.getAuthority() == Authority.SYS_ADMIN) { | |
79 | + if (Authority.SYS_ADMIN.equals(userEntity.getAuthority())) { | |
80 | 80 | return false; |
81 | 81 | } |
82 | 82 | if (!user.getTenantId().equals(userEntity.getTenantId())) { | ... | ... |