Merge pull request #2778 from volodymyr-babak/fix-for-equals
Use equals instead of ==
This commit is contained in:
commit
2eeb11c781
@ -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());
|
||||
}
|
||||
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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())) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user