lib/ddr/auth/group.rb in ddr-models-1.13.1 vs lib/ddr/auth/group.rb in ddr-models-1.13.2
- old
+ new
@@ -1,25 +1,20 @@
+require "delegate"
+
module Ddr
module Auth
- class Group < Agent
+ # Wraps a String
+ class Group < SimpleDelegator
- configure type: RDF::FOAF.Group
-
- validates_format_of :name, with: /\A[\w.:\-]+\z/
-
# The inverse of `Ddr::Auth::User#member_of?(group)`
def has_member?(user)
user.groups.include?(self)
end
- # Override for backward-compatibility with String-based groups
- def method_missing(meth, *args)
- if to_s.respond_to?(meth)
- to_s.send(meth, *args)
- else
- super
- end
+ def to_agent
+ to_s
end
+ alias_method :agent, :to_agent
end
end
end