sbuild
1.5.3
|
00001 /* Copyright © 2005-2009,2012 Roger Leigh <rleigh@debian.org> 00002 * 00003 * schroot is free software: you can redistribute it and/or modify it 00004 * under the terms of the GNU General Public License as published by 00005 * the Free Software Foundation, either version 3 of the License, or 00006 * (at your option) any later version. 00007 * 00008 * schroot is distributed in the hope that it will be useful, but 00009 * WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU General Public License 00014 * along with this program. If not, see 00015 * <http://www.gnu.org/licenses/>. 00016 * 00017 *********************************************************************/ 00018 00019 #ifndef SBUILD_CHROOT_FACET_USERDATA_H 00020 #define SBUILD_CHROOT_FACET_USERDATA_H 00021 00022 #include <sbuild/sbuild-chroot-facet.h> 00023 #include <sbuild/sbuild-custom-error.h> 00024 #include <sbuild/sbuild-types.h> 00025 00026 namespace sbuild 00027 { 00028 00035 class chroot_facet_userdata : public chroot_facet 00036 { 00037 public: 00039 enum error_code 00040 { 00041 ENV_AMBIGUOUS, 00042 KEY_AMBIGUOUS, 00043 KEY_DISALLOWED, 00044 KEYNAME_INVALID 00045 }; 00046 00048 typedef custom_error<error_code> error; 00049 00051 typedef std::shared_ptr<chroot_facet_userdata> ptr; 00052 00054 typedef std::shared_ptr<const chroot_facet_userdata> const_ptr; 00055 00056 private: 00058 chroot_facet_userdata (); 00059 00060 public: 00062 virtual ~chroot_facet_userdata (); 00063 00069 static ptr 00070 create (); 00071 00072 virtual chroot_facet::ptr 00073 clone () const; 00074 00075 virtual std::string const& 00076 get_name () const; 00077 00078 virtual void 00079 setup_env (chroot const& chroot, 00080 environment& env) const; 00081 00082 virtual chroot::session_flags 00083 get_session_flags (chroot const& chroot) const; 00084 00085 virtual void 00086 get_details (chroot const& chroot, 00087 format_detail& detail) const; 00088 00089 virtual void 00090 get_keyfile (chroot const& chroot, 00091 keyfile& keyfile) const; 00092 00093 virtual void 00094 set_keyfile (chroot& chroot, 00095 keyfile const& keyfile, 00096 string_list& used_keys); 00097 00103 string_map const& 00104 get_data () const; 00105 00114 bool 00115 get_data (std::string const& key, 00116 std::string& value) const; 00117 00124 void 00125 set_data (string_map const& data); 00126 00134 void 00135 set_data (std::string const& key, 00136 std::string const& value); 00137 00145 void 00146 set_system_data (std::string const& key, 00147 std::string const& value); 00148 00154 string_set const& 00155 get_user_modifiable_keys () const; 00156 00162 void 00163 set_user_modifiable_keys (string_set const& keys); 00164 00170 string_set const& 00171 get_root_modifiable_keys () const; 00172 00178 void 00179 set_root_modifiable_keys (string_set const& keys); 00180 00188 void 00189 set_user_data(string_map const& data); 00190 00198 void 00199 set_root_data(string_map const& data); 00200 00206 void 00207 set_system_data(string_map const& data); 00208 00209 private: 00217 void 00218 set_data(string_map const& data, 00219 string_set const& allowed_keys, 00220 bool root); 00221 00223 string_map userdata; 00225 string_set env; 00227 string_set user_modifiable_keys; 00229 string_set root_modifiable_keys; 00230 }; 00231 00232 } 00233 00234 #endif /* SBUILD_CHROOT_FACET_USERDATA_H */ 00235 00236 /* 00237 * Local Variables: 00238 * mode:C++ 00239 * End: 00240 */