Project

General

Profile

Download (625 Bytes) Statistics
| Branch: | Tag: | Revision:

def self.hook_before_create(item)
hook_common(item)
end

def self.hook_before_modify(item)
hook_common(item)
end

def self.hook_common(item)
if item.attribute_present?('allowedServices')
user_services = ActiveLdap::Base.find(:all, :scope => :sub, :filter => "(objectClass=userService)", :attributes => ['cn'])
srv_names = user_services.collect {|srv| srv.cn }

invalid_srv_names = item.allowedServices(true) - (item.allowedServices(true) & srv_names)
unless invalid_srv_names.empty?
raise PreProcessingError, "Invalid User Service(s) name(s): " + invalid_srv_names.join(", ")
end
end
end

(3-3/3)