Revision bcd1f70a
Added by Paul Kelly almost 13 years ago
- ID bcd1f70a63a5f167dd8deab3ca538b600f1c1453
app/models/config_template.rb | ||
---|---|---|
# fall back to the os default template
|
||
template ||= templates.os_default_templates_operatingsystem_id_eq(opts[:operatingsystem_id]).first
|
||
template.is_a?(ConfigTemplate) ? template : nil
|
||
end
|
||
|
||
def enforce_permissions operation
|
||
# We get called again with the operation being set to create
|
||
return true if operation == "edit" and new_record?
|
||
|
||
return true if User.current and User.current.allowed_to?("#{operation}_templates".to_sym)
|
||
|
||
errors.add_to_base "You do not have permission to #{operation} this template"
|
||
false
|
||
end
|
||
|
||
private
|
Also available in: Unified diff
Fixes #1071 - ConfigTemplate permission name
Signed-off-by: Paul Kelly <paul.ian.kelly@googlemail.com>