pianod2
multisource multiuser scriptable networked music player
Public Member Functions | Private Attributes | List of all members
PrimaryOwnership Class Reference

Ownership where privilege is defined within the object. More...

#include <ownership.h>

Inheritance diagram for PrimaryOwnership:
Inheritance graph
[legend]
Collaboration diagram for PrimaryOwnership:
Collaboration graph
[legend]

Public Member Functions

 PrimaryOwnership (void)
 Default construct ownership: No owner, private access. More...
 
 PrimaryOwnership (Type rule, User *owner=nullptr)
 Construct ownership. More...
 
 ~PrimaryOwnership (void)
 
void abandon (void)
 Disassociate ownership from any owner, and mark as disowned. More...
 
void abandon (const User *user)
 Conditionally dissociate ownership. More...
 
UsergetOwner (void) const
 
bool isOwned (void) const
 
const std::string & ownerName (void) const
 Retrieve the name of the owner. More...
 
virtual bool isOwnedBy (const User *user) const override
 Check if we are owned by a user. More...
 
virtual bool hasPermission (const User *user, Action action) const override
 Determine if a user has permission to use this item in some manner. More...
 
- Public Member Functions inherited from Ownership
bool isVisibleBy (const User *user) const
 
bool isUsableBy (const User *user) const
 
bool isDecendableBy (const User *user) const
 
bool isReadableBy (const User *user) const
 
bool isEditableBy (const User *user) const
 

Private Attributes

Type access = Type::DISOWNED
 
Userowner = nullptr
 

Additional Inherited Members

- Public Types inherited from Ownership
enum class  Type {
  DISOWNED , PRIVATE , SHARED , PUBLISHED ,
  PUBLIC
}
 Access levels for an object. More...
 
enum class  Action { SEE , USE , READ , ALTER }
 Access actions for an object. More...
 

Detailed Description

Ownership where privilege is defined within the object.

Constructor & Destructor Documentation

◆ PrimaryOwnership() [1/2]

PrimaryOwnership::PrimaryOwnership ( void  )

Default construct ownership: No owner, private access.

◆ PrimaryOwnership() [2/2]

PrimaryOwnership::PrimaryOwnership ( Type  rule,
User owneruser = nullptr 
)

Construct ownership.

Parameters
ruleAccess policy for non-owners.
owneruserThe owner.

◆ ~PrimaryOwnership()

PrimaryOwnership::~PrimaryOwnership ( void  )
Here is the call graph for this function:

Member Function Documentation

◆ abandon() [1/2]

void PrimaryOwnership::abandon ( const User user)

Conditionally dissociate ownership.

Parameters
userThe user attempting dissociation. Dissociation is performed only if this is the user on file.

◆ abandon() [2/2]

void PrimaryOwnership::abandon ( void  )

Disassociate ownership from any owner, and mark as disowned.

Here is the caller graph for this function:

◆ getOwner()

User* PrimaryOwnership::getOwner ( void  ) const
inline
Here is the caller graph for this function:

◆ hasPermission()

bool PrimaryOwnership::hasPermission ( const User user,
Action  action 
) const
overridevirtual

Determine if a user has permission to use this item in some manner.

Parameters
userThe user attempting use.
actionThe type of action the user is performing.
Returns
True if the user owns this item, or the user's chosen access policy allows others to use the item for the requested action.

Implements Ownership.

◆ isOwned()

bool PrimaryOwnership::isOwned ( void  ) const
inline
Here is the caller graph for this function:

◆ isOwnedBy()

bool PrimaryOwnership::isOwnedBy ( const User user) const
overridevirtual

Check if we are owned by a user.

Parameters
userThe user to compare ownership to.
Returns
True if owned by the indicated user, false otherwise.

Implements Ownership.

Here is the caller graph for this function:

◆ ownerName()

const std::string & PrimaryOwnership::ownerName ( void  ) const

Retrieve the name of the owner.

Returns
The user's name, or text indicating no ownership.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ access

Type PrimaryOwnership::access = Type::DISOWNED
private

◆ owner

User* PrimaryOwnership::owner = nullptr
private

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