from PLC.Parameter import Parameter, Mixed
from PLC.Auth import Auth
-from PLC.InterfaceSettingTypes import InterfaceSettingType, InterfaceSettingTypes
+from PLC.TagTypes import TagType, TagTypes
from PLC.InterfaceSettings import InterfaceSetting, InterfaceSettings
from PLC.Interfaces import Interface, Interfaces
to the specified value.
In general only tech(s), PI(s) and of course admin(s) are allowed to
- do the change, but this is defined in the interface setting type object.
+ do the change, but this is defined in the tag type object.
Returns the new interface_setting_id (> 0) if successful, faults
otherwise.
Auth(),
# no other way to refer to a interface
InterfaceSetting.fields['interface_id'],
- Mixed(InterfaceSettingType.fields['interface_setting_type_id'],
- InterfaceSettingType.fields['name']),
+ Mixed(TagType.fields['tag_type_id'],
+ TagType.fields['tagname']),
InterfaceSetting.fields['value'],
]
object_type = 'Interface'
- def call(self, auth, interface_id, interface_setting_type_id_or_name, value):
+ def call(self, auth, interface_id, tag_type_id_or_name, value):
interfaces = Interfaces(self.api, [interface_id])
if not interfaces:
raise PLCInvalidArgument, "No such interface %r"%interface_id
interface = interfaces[0]
- interface_setting_types = InterfaceSettingTypes(self.api, [interface_setting_type_id_or_name])
- if not interface_setting_types:
- raise PLCInvalidArgument, "No such interface setting type %r"%interface_setting_type_id_or_name
- interface_setting_type = interface_setting_types[0]
+ tag_types = TagTypes(self.api, [tag_type_id_or_name])
+ if not tag_types:
+ raise PLCInvalidArgument, "No such tag type %r"%tag_type_id_or_name
+ tag_type = tag_types[0]
# checks for existence - does not allow several different settings
conflicts = InterfaceSettings(self.api,
{'interface_id':interface['interface_id'],
- 'interface_setting_type_id':interface_setting_type['interface_setting_type_id']})
+ 'tag_type_id':tag_type['tag_type_id']})
if len(conflicts) :
raise PLCInvalidArgument, "Interface %d already has setting %d"%(interface['interface_id'],
- interface_setting_type['interface_setting_type_id'])
+ tag_type['tag_type_id'])
# check permission : it not admin, is the user affiliated with the right site
if 'admin' not in self.caller['roles']:
if self.caller['person_id'] not in site['person_ids']:
raise PLCPermissionDenied, "Not a member of the hosting site %s"%site['abbreviated_site']
- required_min_role = interface_setting_type ['min_role_id']
+ required_min_role = tag_type ['min_role_id']
if required_min_role is not None and \
min(self.caller['role_ids']) > required_min_role:
raise PLCPermissionDenied, "Not allowed to modify the specified interface setting, requires role %d",required_min_role
interface_setting = InterfaceSetting(self.api)
interface_setting['interface_id'] = interface['interface_id']
- interface_setting['interface_setting_type_id'] = interface_setting_type['interface_setting_type_id']
+ interface_setting['tag_type_id'] = tag_type['tag_type_id']
interface_setting['value'] = value
interface_setting.sync()