21 #include "core/auth/Group_odb.h" 23 #include "core/auth/User_odb.h" 169 if (group->member_has(
user_id_, &rank))
184 return ugm->user_id() ==
user_id_ ||
214 if (group->member_has(
user_id_, &rank))
234 auto group = membership->group().load();
235 auto target_user = membership->user().load();
242 if (group && group->member_has(
user_id_, &my_rank))
266 for (
const auto &mapping : sched->mapping())
268 if (mapping->has_user_indirect(
self()))
283 for (
const auto &mapping : door->lazy_mapping())
285 auto loaded_mapping = mapping.load();
286 if (loaded_mapping->has_user_indirect(
self()))
300 return is_self(cred->owner_id());
Acts like an odb::transaction, with the exception that it will becomes the active transaction at cons...
This is the header file for a generated source file, GitSHA1.cpp.
bool can_read_membership(const MembershipActionParam &map) const
Can access user management aswel as credential management.
Edit the SMTP configuration.
Auth::UserPtr self() const
Load the User object that owns this security context.
bool can_update_user(const UserActionParam &uap) const
Tools::ScheduleId schedule_id
Cred::CredentialId credential_id
Read the audit log and access additional information, such as the JSON "before" and "after" field...
bool can_read_credential(const CredentialActionParam &cap) const
bool can_read_user(const UserActionParam &uap) const
Username, as well as a few basic (firstname, lastname) info are public.
An optional transaction is an object that behave like an odb::transaction if there is no currently ac...
std::shared_ptr< IDoor > IDoorPtr
std::shared_ptr< Group > GroupPtr
bool is_self(Auth::UserId id) const
Return true if the owner of the security context is the user whose id is id.
virtual bool check_permission(Action a, const ActionParam &ap) const
Check for the permission to perform action a with parameters ap.
A workaround permission that requires the user to be administrator.
bool can_administrate_group(const GroupActionParam &gap) const
UserSecurityContext(DBServicePtr dbsrv, Auth::UserId id)
std::shared_ptr< DBService > DBServicePtr
std::shared_ptr< User > UserPtr
bool is_manager() const
Helper function that returns true if the user is at least manager.
GroupRank
The rank of an User inside a Group.
bool is_admin() const
Helper function that returns true if the user is an administrator.
A SecurityContext is used to query permission while doing an operation.
Requires that the user be at least manager.
std::shared_ptr< UserGroupMembership > UserGroupMembershipPtr
MembershipActionParam membership
#define ASSERT_LOG(cond, msg)
bool can_create_membership(const MembershipActionParam &map) const
bool can_read_schedule(const ScheduleActionParam &sap) const
CredentialActionParam cred
virtual bool check_permission_impl(Action a, const ActionParam &ap) const override
Reimplement this method to provide permission checking.
Perform to restart the Leosac server.
bool can_read_user_detail(const UserActionParam &uap) const
Can we enable/disable the user or change its validity period ?
bool can_delete_membership(const MembershipActionParam &map) const
Can we leave/kick someone from a group.
Ability to list member of a group.
Auth::UserGroupMembershipId membership_id
bool can_read_door(const DoorActionParam &dap) const
virtual bool check_permission_impl(Action a, const ActionParam &ap) const override
Reimplement this method to provide permission checking.
Overview of users/doors access permission.
A SecurityContext object for users.
Auth::UserId user_id() const
Retrieve SMTP configuration.
Editing rank means being able to become administrator.
bool can_read_group(const GroupActionParam &gap) const
ScheduleActionParam sched