1
0
Fork 0
arangodb/UserManager/Role.h

206 lines
7.7 KiB
C++

////////////////////////////////////////////////////////////////////////////////
/// @brief role of 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_ROLE_H
#define TRIAGENS_USER_MANAGER_ROLE_H 1
#include "Basics/Common.h"
#include "UserManager/Right.h"
namespace triagens {
namespace admin {
// -----------------------------------------------------------------------------
// --SECTION-- class Role
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup RestServer
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief role of a user
////////////////////////////////////////////////////////////////////////////////
class Role {
Role (Role const&);
Role& operator= (Role const&);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- static public methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup RestServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a new role
////////////////////////////////////////////////////////////////////////////////
static Role* create (string const& name, right_t manage);
////////////////////////////////////////////////////////////////////////////////
/// @brief returns a role by name
////////////////////////////////////////////////////////////////////////////////
static Role* lookup (string const& name);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup RestServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief constructor
////////////////////////////////////////////////////////////////////////////////
Role (string const& name, right_t manage);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- public methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup RestServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the name of a role
////////////////////////////////////////////////////////////////////////////////
string const& getName () const;
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the rights of a role
////////////////////////////////////////////////////////////////////////////////
set<right_t> const& getRights () const;
////////////////////////////////////////////////////////////////////////////////
/// @brief adds a right to a role
////////////////////////////////////////////////////////////////////////////////
void addRight (right_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief sets the rights of a role
////////////////////////////////////////////////////////////////////////////////
void setRights (vector<right_t> const&);
////////////////////////////////////////////////////////////////////////////////
/// @brief removes a right from a role
////////////////////////////////////////////////////////////////////////////////
void removeRight (right_t);
////////////////////////////////////////////////////////////////////////////////
/// @brief clears all rights of a role
////////////////////////////////////////////////////////////////////////////////
void clearRights ();
////////////////////////////////////////////////////////////////////////////////
/// @brief returns right required to manage this role
////////////////////////////////////////////////////////////////////////////////
right_t rightToManage () const;
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- private variables
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup RestServer
/// @{
////////////////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////////////////
/// @brief name
////////////////////////////////////////////////////////////////////////////////
string const _name;
////////////////////////////////////////////////////////////////////////////////
/// @brief rights
////////////////////////////////////////////////////////////////////////////////
set<right_t> _rights;
////////////////////////////////////////////////////////////////////////////////
/// @brief manager
////////////////////////////////////////////////////////////////////////////////
right_t _rightToManage;
};
}
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#endif
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
// End: