diff --git a/app/models/collections/context.rb b/app/models/collections/context.rb new file mode 100644 index 0000000000000000000000000000000000000000..647b79965eca2b8d09ef1c967699ad78d7c2a6d2 --- /dev/null +++ b/app/models/collections/context.rb @@ -0,0 +1,5 @@ +module Collections + class Context + attr_reader :from, :privacy + end +end diff --git a/app/models/collections/public_context.rb b/app/models/collections/public_context.rb new file mode 100644 index 0000000000000000000000000000000000000000..ad3a7f8a7f1a4e11e3abc716d593115a7ecf1fba --- /dev/null +++ b/app/models/collections/public_context.rb @@ -0,0 +1,11 @@ +## +# This class represents an specification for listing collections +# The PublicContext class specify all collections with field privacy=public +class Collections::PublicContext < Collections::Context + + def initialize + @from = 'Collection' + @privacy = 'public' + end + +end \ No newline at end of file diff --git a/app/models/collections/user_context.rb b/app/models/collections/user_context.rb new file mode 100644 index 0000000000000000000000000000000000000000..5a6d9b1ad6ad0595b92c38d207657373e76ee23b --- /dev/null +++ b/app/models/collections/user_context.rb @@ -0,0 +1,8 @@ +class UserContext < Collections::Context + + def initialize(user) + @user = user + @from = sprintf "select expand(in('BelongsTo')) from %s)", user.rid + end + +end \ No newline at end of file diff --git a/app/models/collections/user_private_context.rb b/app/models/collections/user_private_context.rb new file mode 100644 index 0000000000000000000000000000000000000000..fb60d7df4ca2b253d70e7e2ce67c4be13569fc4a --- /dev/null +++ b/app/models/collections/user_private_context.rb @@ -0,0 +1,10 @@ +## +# This class represents an specification for listing collections +# The PublicContext class specify all collections with field privacy=public +class Collections::UserPrivateContext < Collections::UserContext + + def initialize + @privacy = 'private' + end + +end \ No newline at end of file diff --git a/app/models/collections/user_public_context.rb b/app/models/collections/user_public_context.rb new file mode 100644 index 0000000000000000000000000000000000000000..c5bb5d523706d7b104c6b22dd63e0e55d48d4da4 --- /dev/null +++ b/app/models/collections/user_public_context.rb @@ -0,0 +1,10 @@ +## +# This class represents an specification for listing collections +# The PublicContext class specify all collections with field privacy=public +class Collections::UserPublicContext < Collections::UserContext + + def initialize + @privacy = 'public' + end + +end \ No newline at end of file