Skip to content
Snippets Groups Projects
Commit 700a4c52 authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

adding collections contexts

parent 94c7db04
No related branches found
No related tags found
No related merge requests found
module Collections
class Context
attr_reader :from, :privacy
end
end
##
# 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
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
##
# 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
##
# 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment