Change transaction to bank_transaction for permissions

This commit is contained in:
Hillel Coren 2023-01-23 13:40:52 +02:00
parent fd2d7bb008
commit 706b22beb5
2 changed files with 11 additions and 8 deletions

View File

@ -43,11 +43,8 @@ class EntityType extends EnumClass {
static const EntityType design = _$design; static const EntityType design = _$design;
// STARTER: entity type - do not remove comment // STARTER: entity type - do not remove comment
static const EntityType transactionRule = _$transactionRule; static const EntityType transactionRule = _$transactionRule;
static const EntityType transaction = _$transaction; static const EntityType transaction = _$transaction;
static const EntityType bankAccount = _$bankAccount; static const EntityType bankAccount = _$bankAccount;
static const EntityType recurringExpense = _$recurringExpense; static const EntityType recurringExpense = _$recurringExpense;
static const EntityType recurringQuote = _$recurringQuote; static const EntityType recurringQuote = _$recurringQuote;
static const EntityType subscription = _$subscription; static const EntityType subscription = _$subscription;
@ -231,6 +228,14 @@ class EntityType extends EnumClass {
String get snakeCase => toSnakeCase(toString()); String get snakeCase => toSnakeCase(toString());
String get apiValue {
if (this == EntityType.transaction) {
return 'bank_transaction';
}
return snakeCase;
}
bool get hasFullWidthViewer => [ bool get hasFullWidthViewer => [
EntityType.client, EntityType.client,
EntityType.vendor, EntityType.vendor,

View File

@ -19,7 +19,6 @@ import 'package:invoiceninja_flutter/ui/user/edit/user_edit_vm.dart';
import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/completers.dart';
import 'package:invoiceninja_flutter/utils/localization.dart'; import 'package:invoiceninja_flutter/utils/localization.dart';
import 'package:invoiceninja_flutter/utils/platforms.dart'; import 'package:invoiceninja_flutter/utils/platforms.dart';
import 'package:invoiceninja_flutter/utils/strings.dart';
class UserEdit extends StatefulWidget { class UserEdit extends StatefulWidget {
const UserEdit({ const UserEdit({
@ -360,10 +359,9 @@ class _UserEditState extends State<UserEdit>
.where((entityType) => .where((entityType) =>
state.company.isModuleEnabled(entityType)) state.company.isModuleEnabled(entityType))
.map((EntityType type) { .map((EntityType type) {
final createPermission = final createPermission = 'create_' + type.apiValue;
'create_' + toSnakeCase('$type'); final editPermission = 'edit_' + type.apiValue;
final editPermission = 'edit_' + toSnakeCase('$type'); final viewPermission = 'view_' + type.apiValue;
final viewPermission = 'view_' + toSnakeCase('$type');
return DataRow(cells: [ return DataRow(cells: [
DataCell(Text(localization.lookup('$type')), DataCell(Text(localization.lookup('$type')),
onTap: () { onTap: () {