Fabrice Gabolde

NAME

Zabbix2::API::User -- Zabbix user objects

SYNOPSIS

  use Zabbix2::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 CRUD for Zabbix user objects.

This is a subclass of Zabbix2::API::CRUDE; see there for inherited methods.

METHODS

usergroups()

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

add_to_usergroup(USERGROUP_OR_NAME)

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

set_usergroups(LIST_OF_USERGROUPS_OR_NAMES)

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

set_password(NEW_PASSWORD)

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

name()

Accessor for the user's name (the "alias" 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 $user-data->{type}> attribute to one of these.

Nothing is exported by default; you can use the tag :user_types (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. "admin", "Admin" and "ADMIN" will all work). I have not tested this for filtering/searching/colliding users.

WHERE'S THE remove_from_usergroup METHOD?

This is where it is.

SEE ALSO

Zabbix2::API::CRUDE.

AUTHOR

Fabrice Gabolde <fga@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2013 SFR

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