Granada  1.54.0
Structured layer on top of C++ REST SDK for building server applications in C++. Granada implements sessions, server side plug-in framework, C++ OAuth 2.0 server, data storage access, server script running, server browsing.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
granada::http::session::SessionRoles Class Reference

#include <session.h>

Inheritance diagram for granada::http::session::SessionRoles:
granada::http::session::MapSessionRoles granada::http::session::RedisSessionRoles

Public Member Functions

 SessionRoles ()
 
 SessionRoles (granada::http::session::Session *session)
 
virtual void SetSession (granada::http::session::Session *session)
 
virtual const bool Is (const std::string &role_name)
 
virtual const bool Add (const std::string &role_name)
 
virtual void Remove (const std::string &role_name)
 
virtual void RemoveAll ()
 
virtual void SetProperty (const std::string &role_name, const std::string &key, const std::string &value)
 
virtual const std::string GetProperty (const std::string &role_name, const std::string &key)
 
virtual void DestroyProperty (const std::string &role_name, const std::string &key)
 

Protected Member Functions

virtual const std::string session_roles_hash (const std::string &role_name)
 

Protected Attributes

granada::http::session::Sessionsession_
 

Detailed Description

Class for managing session roles. Roles are used to manage user permissions, for example letting or not the user to access some data.

Constructor & Destructor Documentation

granada::http::session::SessionRoles::SessionRoles ( )
inline

Constructor

granada::http::session::SessionRoles::SessionRoles ( granada::http::session::Session session)
inline

Constructor

Parameters
sessionPointer to session owner of the roles.

Member Function Documentation

virtual const bool granada::http::session::SessionRoles::Add ( const std::string &  role_name)
virtual

Add a new role if it has not already been added.

Parameters
role_nameName of the role.
Returns
True if role added correctly, false if the role has not been added, for example because the role is already added.
virtual void granada::http::session::SessionRoles::DestroyProperty ( const std::string &  role_name,
const std::string &  key 
)
virtual

Remove a role property.

Parameters
role_nameRole name.
keyKey or name of the property.
virtual const std::string granada::http::session::SessionRoles::GetProperty ( const std::string &  role_name,
const std::string &  key 
)
virtual

Get a role property, returns a string.

Parameters
role_nameRole name.
keyKey or name of the property.
Returns
Value of the property (string).
virtual const bool granada::http::session::SessionRoles::Is ( const std::string &  role_name)
virtual

Check if the role with the given name is stored. Returns true if the role is found or false if it does not.

Parameters
role_nameName of the role to check.
Returns
true | false
virtual void granada::http::session::SessionRoles::Remove ( const std::string &  role_name)
virtual

Remove a role.

Parameters
role_nameName of the role.
virtual void granada::http::session::SessionRoles::RemoveAll ( )
virtual

Remove all roles.

virtual const std::string granada::http::session::SessionRoles::session_roles_hash ( const std::string &  role_name)
inlineprotectedvirtual

Returns the key to access a role data.

Parameters
role_nameName of the role.
Returns
Returns the key to access a role data.
virtual void granada::http::session::SessionRoles::SetProperty ( const std::string &  role_name,
const std::string &  key,
const std::string &  value 
)
virtual

Set a role property, it has to be a string.

Parameters
role_nameRole name
keyKey or name of the property.
valueValue of the property.
virtual void granada::http::session::SessionRoles::SetSession ( granada::http::session::Session session)
inlinevirtual

Sets the session owner of the roles.

Parameters
sessionPointer to session owner of the roles.

Member Data Documentation

granada::http::session::Session* granada::http::session::SessionRoles::session_
protected

Pointer of the session, owner of the roles.


The documentation for this class was generated from the following file: