Ejemplo n.º 1
0
        public static PermissionMeta Parse(JObject m)
        {
            PermissionMeta meta = new PermissionMeta();

            if (m["revision"] != null)
            {
                meta.Revision = m["revision"].Value <int>();
            }

            if (m["created"] != null)
            {
                meta.Created = TypeUtils.UnixEpoch.AddMilliseconds(m["created"].Value <long>());
            }

            if (m["version"] != null)
            {
                meta.Version = m["version"].Value <int>();
            }

            if (m["updated"] != null)
            {
                meta.Updated = TypeUtils.UnixEpoch.AddMilliseconds(m["updated"].Value <long>());
            }

            return(meta);
        }
Ejemplo n.º 2
0
        public static Permission Parse(JObject m)
        {
            Permission permission = new Permission();

            if (m["_id"] != null)
            {
                permission.Id = m["_id"].Value <string>();
            }

            permission.Roles = new List <string>();
            if (m["roles"] != null)
            {
                foreach (var role in m["roles"] as JArray)
                {
                    permission.Roles.Add(role.Value <string>());
                }
            }

            if (m["_updatedAt"] != null)
            {
                permission.UpdatedAt = TypeUtils.ParseDateTime(m["_updatedAt"] as JObject);
            }

            if (m["meta"] != null)
            {
                permission.Meta = PermissionMeta.Parse(m["meta"] as JObject);
            }

            return(permission);
        }