SubjectAccessReviewSpec.fromJson constructor

SubjectAccessReviewSpec.fromJson(
  1. Map<String, dynamic> json
)

Creates a SubjectAccessReviewSpec from JSON data.

Implementation

factory SubjectAccessReviewSpec.fromJson(Map<String, dynamic> json) {
  final tempExtraJson = json['extra'];
  final tempGroupsJson = json['groups'];
  final tempNonResourceAttributesJson = json['nonResourceAttributes'];
  final tempResourceAttributesJson = json['resourceAttributes'];
  final tempUidJson = json['uid'];
  final tempUserJson = json['user'];

  final Map<String, List<String>>? tempExtra = tempExtraJson != null
      ? Map<String, dynamic>.from(tempExtraJson)
          .map((key, value) => MapEntry(key, List<String>.from(value)))
      : null;

  final List<String>? tempGroups =
      tempGroupsJson != null ? List<String>.from(tempGroupsJson) : null;
  final NonResourceAttributes? tempNonResourceAttributes =
      tempNonResourceAttributesJson != null
          ? NonResourceAttributes.fromJson(tempNonResourceAttributesJson)
          : null;
  final ResourceAttributes? tempResourceAttributes =
      tempResourceAttributesJson != null
          ? ResourceAttributes.fromJson(tempResourceAttributesJson)
          : null;
  final String? tempUid = tempUidJson;
  final String? tempUser = tempUserJson;

  return SubjectAccessReviewSpec(
    extra: tempExtra,
    groups: tempGroups,
    nonResourceAttributes: tempNonResourceAttributes,
    resourceAttributes: tempResourceAttributes,
    uid: tempUid,
    user: tempUser,
  );
}