Skip to content

Commit

Permalink
Add ACL scope name and convenience lenses
Browse files Browse the repository at this point in the history
  • Loading branch information
astrada committed May 15, 2012
1 parent 7efa26f commit 3d31218
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
18 changes: 15 additions & 3 deletions src/gdata/gdataACL.ml
Expand Up @@ -54,7 +54,8 @@ module Scope =
struct
type t = {
_type : string;
value : string
value : string;
name : string;
}

let _type = {
Expand All @@ -65,16 +66,22 @@ struct
GapiLens.get = (fun x -> x.value);
GapiLens.set = (fun v x -> { x with value = v })
}
let name = {
GapiLens.get = (fun x -> x.name);
GapiLens.set = (fun v x -> { x with name = v })
}

let empty = {
_type = "";
value = ""
value = "";
name = "";
}

let to_xml_data_model scope =
GdataAtom.render_element ns_gAcl "scope"
[GdataAtom.render_attribute "" "type" scope._type;
GdataAtom.render_attribute "" "value" scope.value]
GdataAtom.render_attribute "" "value" scope.value;
GdataAtom.render_attribute "" "name" scope.name]

let of_xml_data_model scope tree =
match tree with
Expand All @@ -86,6 +93,10 @@ struct
([`Attribute; `Name "value"; `Namespace ""],
v) ->
{ scope with value = v }
| GapiCore.AnnotatedTree.Leaf
([`Attribute; `Name "name"; `Namespace ""],
v) ->
{ scope with name = v }
| GapiCore.AnnotatedTree.Leaf
([`Attribute; `Name _; `Namespace ns],
_) when ns = Xmlm.ns_xmlns ->
Expand Down Expand Up @@ -134,6 +145,7 @@ struct
let etag = common |-- GdataAtom.BasicEntry.etag
let id = common |-- GdataAtom.BasicEntry.id
let links = common |-- GdataAtom.BasicEntry.links
let categories = common |-- GdataAtom.BasicEntry.categories

let empty = {
common = GdataAtom.BasicEntry.empty;
Expand Down
7 changes: 5 additions & 2 deletions src/gdata/gdataACL.mli
Expand Up @@ -7,7 +7,7 @@ module RoleWithKey :
sig
type t = {
key : string;
role : string
role : string;
}

val key : (t, string) GapiLens.t
Expand All @@ -21,11 +21,13 @@ module Scope :
sig
type t = {
_type : string;
value : string
value : string;
name : string;
}

val _type : (t, string) GapiLens.t
val value : (t, string) GapiLens.t
val name : (t, string) GapiLens.t

include GdataAtom.AtomData with type t := t

Expand All @@ -52,6 +54,7 @@ sig
val etag : (t, string) GapiLens.t
val id : (t, GdataAtom.atom_id) GapiLens.t
val links : (t, GdataAtom.Link.t list) GapiLens.t
val categories : (t, GdataAtom.Category.t list) GapiLens.t

include GdataAtom.AtomData with type t := t

Expand Down

0 comments on commit 3d31218

Please sign in to comment.