mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-11 10:08:02 -06:00
FEATURE fix permissions model
This commit is contained in:
@@ -22,7 +22,16 @@
|
|||||||
"archived_file_name": "2022-03-22 no latin title.pdf",
|
"archived_file_name": "2022-03-22 no latin title.pdf",
|
||||||
"owner": null,
|
"owner": null,
|
||||||
"user_can_change": true,
|
"user_can_change": true,
|
||||||
|
"permissions": {
|
||||||
|
"view": {
|
||||||
|
"users": [],
|
||||||
|
"groups": []
|
||||||
|
},
|
||||||
|
"change": {
|
||||||
|
"users": [],
|
||||||
|
"groups": []
|
||||||
|
}
|
||||||
|
},
|
||||||
"notes": [
|
"notes": [
|
||||||
{
|
{
|
||||||
"id": 9,
|
"id": 9,
|
||||||
@@ -61,7 +70,16 @@
|
|||||||
"archived_file_name": "2022-03-23 llorem ipsum dolor sit amet.pdf",
|
"archived_file_name": "2022-03-23 llorem ipsum dolor sit amet.pdf",
|
||||||
"owner": null,
|
"owner": null,
|
||||||
"user_can_change": true,
|
"user_can_change": true,
|
||||||
|
"permissions": {
|
||||||
|
"view": {
|
||||||
|
"users": [],
|
||||||
|
"groups": []
|
||||||
|
},
|
||||||
|
"change": {
|
||||||
|
"users": [],
|
||||||
|
"groups": []
|
||||||
|
}
|
||||||
|
},
|
||||||
"notes": []
|
"notes": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -83,7 +101,16 @@
|
|||||||
"archived_file_name": "2022-03-24 dolor.pdf",
|
"archived_file_name": "2022-03-24 dolor.pdf",
|
||||||
"owner": null,
|
"owner": null,
|
||||||
"user_can_change": true,
|
"user_can_change": true,
|
||||||
|
"permissions": {
|
||||||
|
"view": {
|
||||||
|
"users": [],
|
||||||
|
"groups": []
|
||||||
|
},
|
||||||
|
"change": {
|
||||||
|
"users": [],
|
||||||
|
"groups": []
|
||||||
|
}
|
||||||
|
},
|
||||||
"notes": []
|
"notes": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -105,7 +132,16 @@
|
|||||||
"archived_file_name": "2022-06-01 sit amet.pdf",
|
"archived_file_name": "2022-06-01 sit amet.pdf",
|
||||||
"owner": null,
|
"owner": null,
|
||||||
"user_can_change": true,
|
"user_can_change": true,
|
||||||
|
"permissions": {
|
||||||
|
"view": {
|
||||||
|
"users": [],
|
||||||
|
"groups": []
|
||||||
|
},
|
||||||
|
"change": {
|
||||||
|
"users": [],
|
||||||
|
"groups": []
|
||||||
|
}
|
||||||
|
},
|
||||||
"notes": []
|
"notes": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -125,7 +161,16 @@
|
|||||||
"archived_file_name": "doc5.pdf",
|
"archived_file_name": "doc5.pdf",
|
||||||
"owner": 15,
|
"owner": 15,
|
||||||
"user_can_change": true,
|
"user_can_change": true,
|
||||||
|
"permissions": {
|
||||||
|
"view": {
|
||||||
|
"users": [],
|
||||||
|
"groups": []
|
||||||
|
},
|
||||||
|
"change": {
|
||||||
|
"users": [],
|
||||||
|
"groups": []
|
||||||
|
}
|
||||||
|
},
|
||||||
"notes": []
|
"notes": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class PaperlessApiHiveTypeIds {
|
|||||||
static const int groupModel = 124;
|
static const int groupModel = 124;
|
||||||
static const int permissions = 125;
|
static const int permissions = 125;
|
||||||
static const int userModelv2 = 126;
|
static const int userModelv2 = 126;
|
||||||
|
static const int usersAndGroupsPermissions = 127;
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerPaperlessApiHiveTypeAdapters() {
|
void registerPaperlessApiHiveTypeAdapters() {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:paperless_api/paperless_api.dart';
|
import 'package:paperless_api/paperless_api.dart';
|
||||||
|
import 'package:paperless_api/src/models/permissions/users_and_groups_permissions.dart';
|
||||||
|
|
||||||
part 'permissions.freezed.dart';
|
part 'permissions.freezed.dart';
|
||||||
part 'permissions.g.dart';
|
part 'permissions.g.dart';
|
||||||
@@ -9,8 +10,8 @@ part 'permissions.g.dart';
|
|||||||
@freezed
|
@freezed
|
||||||
class Permissions with _$Permissions {
|
class Permissions with _$Permissions {
|
||||||
const factory Permissions({
|
const factory Permissions({
|
||||||
@HiveField(0) @Default([]) List<int> view,
|
@HiveField(0) required UsersAndGroupsPermissions view,
|
||||||
@HiveField(1) @Default([]) List<int> change,
|
@HiveField(1) required UsersAndGroupsPermissions change,
|
||||||
}) = _Permissions;
|
}) = _Permissions;
|
||||||
|
|
||||||
factory Permissions.fromJson(Map<String, dynamic> json) => _$PermissionsFromJson(json);
|
factory Permissions.fromJson(Map<String, dynamic> json) => _$PermissionsFromJson(json);
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:paperless_api/paperless_api.dart';
|
||||||
|
|
||||||
|
part 'users_and_groups_permissions.freezed.dart';
|
||||||
|
part 'users_and_groups_permissions.g.dart';
|
||||||
|
|
||||||
|
@HiveType(typeId: PaperlessApiHiveTypeIds.usersAndGroupsPermissions)
|
||||||
|
@freezed
|
||||||
|
class UsersAndGroupsPermissions with _$UsersAndGroupsPermissions {
|
||||||
|
const factory UsersAndGroupsPermissions({
|
||||||
|
@HiveField(0) @Default([]) List<int> users,
|
||||||
|
@HiveField(1) @Default([]) List<int> groups,
|
||||||
|
}) = _UsersAndGroupsPermissions;
|
||||||
|
|
||||||
|
factory UsersAndGroupsPermissions.fromJson(Map<String, dynamic> json) => _$UsersAndGroupsPermissionsFromJson(json);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user