1
0
Fork 0
arangodb/UserManager/User.h

221 lines
8.1 KiB
C++

////////////////////////////////////////////////////////////////////////////////
/// @brief a user
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#ifndef TRIAGENS_USER_MANAGER_USER_H
#define TRIAGENS_USER_MANAGER_USER_H 1
#include "Basics/Common.h"
#include <UserManager/Right.h>
namespace triagens {
namespace admin {
class Role;
// -----------------------------------------------------------------------------
// --SECTION-- class User
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup RestServer
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief a user
////////////////////////////////////////////////////////////////////////////////
class User {
User (User const&);
User& operator= (User const&);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- static public methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup RestServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief adds a new user
////////////////////////////////////////////////////////////////////////////////
static User* create (string const& name, Role*);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns a role by name
////////////////////////////////////////////////////////////////////////////////
static User* lookup (string const& name);
////////////////////////////////////////////////////////////////////////////////
/// @brief removes a user
///
/// Remove will also delete the user object.
////////////////////////////////////////////////////////////////////////////////
static bool remove (User*);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns a role by name
////////////////////////////////////////////////////////////////////////////////
static vector<User*> users ();
////////////////////////////////////////////////////////////////////////////////
/// @brief loads the user database
////////////////////////////////////////////////////////////////////////////////
static bool loadUser (string const& file);
////////////////////////////////////////////////////////////////////////////////
/// @brief saves the user database
////////////////////////////////////////////////////////////////////////////////
static void saveUser ();
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup RestServer
/// @{
////////////////////////////////////////////////////////////////////////////////
protected:
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a new user
////////////////////////////////////////////////////////////////////////////////
User (string const& name, Role*);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- public methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup RestServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the name of a user
////////////////////////////////////////////////////////////////////////////////
string const& getName () const;
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the role of a user
////////////////////////////////////////////////////////////////////////////////
Role* getRole () const;
////////////////////////////////////////////////////////////////////////////////
/// @brief changes the password of a user
////////////////////////////////////////////////////////////////////////////////
bool changePassword (string const& password);
////////////////////////////////////////////////////////////////////////////////
/// @brief checks the password of a user
////////////////////////////////////////////////////////////////////////////////
bool checkPassword (string const& password);
////////////////////////////////////////////////////////////////////////////////
/// @brief has right
////////////////////////////////////////////////////////////////////////////////
bool hasRight (right_t);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- private variables
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup RestServer
/// @{
////////////////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////////////////
/// @brief name
////////////////////////////////////////////////////////////////////////////////
string const _name;
////////////////////////////////////////////////////////////////////////////////
/// @brief password
////////////////////////////////////////////////////////////////////////////////
string _password;
////////////////////////////////////////////////////////////////////////////////
/// @brief role
////////////////////////////////////////////////////////////////////////////////
Role* _role;
};
}
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#endif
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
// End: