SYNOPSIS

  use Zabbix::API::User;
  # fetch a single user by login ("alias")
  my $user = $zabbix->fetch('User', params => { filter => { alias => 'luser' } })->[0];

  # and delete it
  $user->delete;

DESCRIPTION

Handles \s-1CRUD\s0 for Zabbix user objects.

This is a subclass of \*(C`Zabbix::API::CRUDE\*(C'; see there for inherited methods.

METHODS

usergroups()

Returns an arrayref of the user's usergroups (possibly empty) as Zabbix::API::UserGroup objects.

add_to_usergroup(\s-1USERGROUP_OR_NAME\s0)

Takes a Zabbix::API::UserGroup instance or a valid usergroup name, and adds the current user to the group. Returns $self.

set_usergroups(\s-1LIST_OF_USERGROUPS_OR_NAMES\s0)

Takes a list of Zabbix::API::UserGroup instances or valid usergroup names, and sets the user/usergroup relationship appropriately. Returns $self.

set_password(\s-1NEW_PASSWORD\s0)

Sets the user's password. The modified user is not pushed automatically to the server.

name()

Accessor for the user's name (the \*(L"alias\*(R" attribute).

collides()

This method returns a list of users colliding (i.e. matching) this one. If there if more than one colliding user found the implementation can not know on which one to perform updates and will bail out.

EXPORTS

User types are implemented as constants:

USER_TYPE_USER USER_TYPE_ADMIN USER_TYPE_SUPERADMIN

Promote (or demote) users by setting their \*(C`$user-\*(C'data->{type}> attribute to one of these.

Nothing is exported by default; you can use the tag \*(C`:user_types\*(C' (or import by name).

BUGS AND ODDITIES

Apparently when logging in via the web page Zabbix does not care about the case of your username (e.g. \*(L"admin\*(R", \*(L"Admin\*(R" and \*(L"\s-1ADMIN\s0\*(R" will all work). I have not tested this for filtering/searching/colliding users.

\s-1WHERE\s0'S \s-1THE\s0 remove_from_usergroup \s-1METHOD\s0?

This <https://support.zabbix.com/browse/ZBX-6124> is where it is.

RELATED TO Zabbix::API::User…

Zabbix::API::CRUDE.

AUTHOR

Fabrice Gabolde <[email protected]>

COPYRIGHT AND LICENSE

Copyright (C) 2013 \s-1SFR\s0

This library is free software; you can redistribute it and/or modify it under the terms of the GPLv3.