Merge pull request #2778 from volodymyr-babak/fix-for-equals

Use equals instead of ==
This commit is contained in:
Igor Kulikov 2020-05-15 19:36:44 +03:00 committed by GitHub
commit 2eeb11c781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 8 deletions

View File

@ -135,7 +135,7 @@ public class UserController extends BaseController {
HttpServletRequest request) throws ThingsboardException {
try {
if (getCurrentUser().getAuthority() == Authority.TENANT_ADMIN) {
if (Authority.TENANT_ADMIN.equals(getCurrentUser().getAuthority())) {
user.setTenantId(getCurrentUser().getTenantId());
}

View File

@ -60,7 +60,7 @@ public class WidgetTypeController extends BaseController {
@ResponseBody
public WidgetType saveWidgetType(@RequestBody WidgetType widgetType) throws ThingsboardException {
try {
if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) {
if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) {
widgetType.setTenantId(TenantId.SYS_TENANT_ID);
} else {
widgetType.setTenantId(getCurrentUser().getTenantId());

View File

@ -61,7 +61,7 @@ public class WidgetsBundleController extends BaseController {
@ResponseBody
public WidgetsBundle saveWidgetsBundle(@RequestBody WidgetsBundle widgetsBundle) throws ThingsboardException {
try {
if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) {
if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) {
widgetsBundle.setTenantId(TenantId.SYS_TENANT_ID);
} else {
widgetsBundle.setTenantId(getCurrentUser().getTenantId());
@ -103,7 +103,7 @@ public class WidgetsBundleController extends BaseController {
@RequestParam(required = false) String sortOrder) throws ThingsboardException {
try {
PageLink pageLink = createPageLink(pageSize, page, textSearch, sortProperty, sortOrder);
if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) {
if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) {
return checkNotNull(widgetsBundleService.findSystemWidgetsBundlesByPageLink(getTenantId(), pageLink));
} else {
TenantId tenantId = getCurrentUser().getTenantId();
@ -119,7 +119,7 @@ public class WidgetsBundleController extends BaseController {
@ResponseBody
public List<WidgetsBundle> getWidgetsBundles() throws ThingsboardException {
try {
if (getCurrentUser().getAuthority() == Authority.SYS_ADMIN) {
if (Authority.SYS_ADMIN.equals(getCurrentUser().getAuthority())) {
return checkNotNull(widgetsBundleService.findSystemWidgetsBundles(getTenantId()));
} else {
TenantId tenantId = getCurrentUser().getTenantId();

View File

@ -105,7 +105,7 @@ public class CustomerUserPermissions extends AbstractPermissions {
@Override
public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) {
if (userEntity.getAuthority() != Authority.CUSTOMER_USER) {
if (!Authority.CUSTOMER_USER.equals(userEntity.getAuthority())) {
return false;
}
if (!user.getId().equals(userId)) {

View File

@ -57,7 +57,7 @@ public class SysAdminPermissions extends AbstractPermissions {
@Override
public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) {
if (userEntity.getAuthority() == Authority.CUSTOMER_USER) {
if (Authority.CUSTOMER_USER.equals(userEntity.getAuthority())) {
return false;
}
return true;

View File

@ -76,7 +76,7 @@ public class TenantAdminPermissions extends AbstractPermissions {
@Override
public boolean hasPermission(SecurityUser user, Operation operation, UserId userId, User userEntity) {
if (userEntity.getAuthority() == Authority.SYS_ADMIN) {
if (Authority.SYS_ADMIN.equals(userEntity.getAuthority())) {
return false;
}
if (!user.getTenantId().equals(userEntity.getTenantId())) {