irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

user_administration.hpp
Go to the documentation of this file.
1 #ifndef IRODS_USER_ADMINISTRATION_HPP
2 #define IRODS_USER_ADMINISTRATION_HPP
3 
4 #undef NAMESPACE_IMPL
5 #undef rxComm
6 
7 #ifdef IRODS_USER_ADMINISTRATION_ENABLE_SERVER_SIDE_API
8  #define NAMESPACE_IMPL server
9  #define rxComm rsComm_t
10 #else
11  #define NAMESPACE_IMPL client
12  #define rxComm rcComm_t
13 #endif // IRODS_USER_ADMINISTRATION_ENABLE_SERVER_SIDE_API
14 
15 #include "rcConnect.h"
16 #include "user.hpp"
17 #include "group.hpp"
18 
19 #include <vector>
20 #include <string>
21 #include <optional>
22 #include <ostream>
23 #include <system_error>
24 #include <stdexcept>
25 
27 {
28  inline namespace v1
29  {
30  // Types
31 
32  enum class user_type
33  {
34  rodsuser,
35  groupadmin,
36  rodsadmin
37  }; // user_type
38 
39  enum class zone_type
40  {
41  local,
42  remote
43  }; // zone_type
44 
45  // Exceptions
46 
48  : std::runtime_error
49  {
50  public:
51  using std::runtime_error::runtime_error;
52  };
53  } // namespace v1
54 } // irods::experimental::administration
55 
57 {
58  inline namespace v1
59  {
60  // User Management
61 
62  auto add_user(rxComm& conn,
63  const user& user,
64  user_type user_type = user_type::rodsuser,
65  zone_type zone_type = zone_type::local) -> std::error_code;
66 
67  auto remove_user(rxComm& conn, const user& user) -> std::error_code;
68 
69  auto set_user_password(rxComm& conn, const user& user, std::string_view new_password) -> std::error_code;
70 
71  auto set_user_type(rxComm& conn, const user& user, user_type new_user_type) -> std::error_code;
72 
73  auto add_user_auth(rxComm& conn, const user& user, std::string_view auth) -> std::error_code;
74 
75  auto remove_user_auth(rxComm& conn, const user& user, std::string_view auth) -> std::error_code;
76 
77  // Group Management
78 
79  auto add_group(rxComm& conn, const group& group) -> std::error_code;
80 
81  auto remove_group(rxComm& conn, const group& group) -> std::error_code;
82 
83  auto add_user_to_group(rxComm& conn, const group& group, const user& user) -> std::error_code;
84 
85  auto remove_user_from_group(rxComm& conn, const group& group, const user& user) -> std::error_code;
86 
87  // Query
88 
89  auto users(rxComm& conn) -> std::vector<user>;
90  auto users(rxComm& conn, const group& group) -> std::vector<user>;
91 
92  auto groups(rxComm& conn) -> std::vector<group>;
93  auto groups(rxComm& conn, const user& user) -> std::vector<group>;
94 
95  auto exists(rxComm& conn, const user& user) -> bool;
96  auto exists(rxComm& conn, const group& group) -> bool;
97 
98  auto id(rxComm& conn, const user& user) -> std::optional<std::string>;
99  auto id(rxComm& conn, const group& group) -> std::optional<std::string>;
100 
101  auto type(rxComm& conn, const user& user) -> std::optional<user_type>;
102  auto auth_names(rxComm& conn, const user& user) -> std::vector<std::string>;
103 
104  auto user_is_member_of_group(rxComm& conn, const group& group, const user& user) -> bool;
105 
106  // Utility
107 
108  auto local_unique_name(rxComm& conn, const user& user) -> std::string;
109  } // namespace v1
110 } // namespace irods::experimental::administration::NAMESPACE_IMPL
111 
112 #endif // IRODS_USER_ADMINISTRATION_HPP
113 
irods::experimental::administration::client::v1::users
auto users(rcComm_t &conn, const group &group) -> std::vector< user >
Definition: user_administration.cpp:301
irods::experimental::administration::v1::zone_type::local
@ local
irods::experimental::administration::client::v1::add_user
auto add_user(rcComm_t &conn, const user &user, user_type user_type=user_type::rodsuser, zone_type zone_type=zone_type::local) -> std::error_code
Definition: user_administration.cpp:102
NAMESPACE_IMPL
#define NAMESPACE_IMPL
Definition: user_administration.hpp:11
irods::experimental::administration::client::v1::add_group
auto add_group(rcComm_t &conn, const group &group) -> std::error_code
Definition: user_administration.cpp:219
rcConnect.h
irods::experimental::administration::v1::user
Definition: user.hpp:13
id
long long id
Definition: filesystem.cpp:105
group.hpp
irods::experimental::administration::v1::user_type
user_type
Definition: user_administration.hpp:33
irods::auth
Definition: irods_auth_plugin.hpp:17
irods::experimental::administration::client::v1::local_unique_name
auto local_unique_name(rcComm_t &conn, const user &user) -> std::string
Definition: user_administration.cpp:469
irods::experimental::administration::client::v1::add_user_auth
auto add_user_auth(rcComm_t &conn, const user &user, std::string_view auth) -> std::error_code
Definition: user_administration.cpp:181
rxComm
#define rxComm
Definition: user_administration.hpp:12
irods::experimental::administration::client::v1::groups
auto groups(rcComm_t &conn, const user &user) -> std::vector< group >
Definition: user_administration.cpp:328
user.hpp
irods::experimental::administration::client::v1::remove_user_auth
auto remove_user_auth(rcComm_t &conn, const user &user, std::string_view auth) -> std::error_code
Definition: user_administration.cpp:199
irods::experimental::administration::v1::user_type::rodsuser
@ rodsuser
irods::experimental::administration::client::v1::add_user_to_group
auto add_user_to_group(rcComm_t &conn, const group &group, const user &user) -> std::error_code
Definition: user_administration.cpp:254
irods::experimental::administration::v1::user_management_error
Definition: user_administration.hpp:49
irods::experimental::administration
Definition: group.hpp:8
irods::experimental::administration::client::v1::set_user_type
auto set_user_type(rcComm_t &conn, const user &user, user_type new_user_type) -> std::error_code
Definition: user_administration.cpp:163
irods::experimental::administration::client::v1::user_is_member_of_group
auto user_is_member_of_group(rcComm_t &conn, const group &group, const user &user) -> bool
Definition: user_administration.cpp:449
irods::experimental::administration::client::v1::remove_user_from_group
auto remove_user_from_group(rcComm_t &conn, const group &group, const user &user) -> std::error_code
Definition: user_administration.cpp:271
irods::experimental::administration::client::v1::set_user_password
auto set_user_password(rcComm_t &conn, const user &user, std::string_view new_password) -> std::error_code
Definition: user_administration.cpp:145
irods::experimental::administration::v1::group
Definition: group.hpp:12
irods::experimental::administration::client::v1::remove_user
auto remove_user(rcComm_t &conn, const user &user) -> std::error_code
Definition: user_administration.cpp:128
irods::experimental::administration::client::v1::auth_names
auto auth_names(rcComm_t &conn, const user &user) -> std::vector< std::string >
Definition: user_administration.cpp:432
irods::experimental::administration::v1::zone_type
zone_type
Definition: user_administration.hpp:40
type
int type
Definition: filesystem.cpp:103
irods::experimental::administration::client::v1::exists
auto exists(rcComm_t &conn, const group &group) -> bool
Definition: user_administration.cpp:375
irods::experimental::administration::client::v1::remove_group
auto remove_group(rcComm_t &conn, const group &group) -> std::error_code
Definition: user_administration.cpp:237