User Permission
DearDiary.get_userpermission — Function
get_userpermission(user_id::Integer, project_id::Integer)::Optional{UserPermission}Get a UserPermission by User id and Project IDs.
Arguments
user_id::Integer: The id of the user.project_id::Integer: The id of the project.
Returns
A UserPermission object. If the record does not exist, return nothing.
DearDiary.create_userpermission — Function
create_userpermission(user_id::Integer, project_id::Integer, create_permission::Bool, read_permission::Bool, update_permission::Bool, delete_permission::Bool)::NamedTuple{id::Optional{<:Int64},status::UpsertResult}Create a UserPermission.
Arguments
user_id::Integer: The id of the user.project_id::Integer: The id of the project.create_permission::Bool: Whether the user has create permission.read_permission::Bool: Whether the user has read permission.update_permission::Bool: Whether the user has update permission.delete_permission::Bool: Whether the user has delete permission.
Returns
- The created userpermission ID. If an error occurs,
nothingis returned. - An
UpsertResult.Createdif the record was successfully created,Duplicateif the record already exists,Unprocessableif the record violates a constraint, andErrorif an error occurred while creating the record.
DearDiary.update_userpermission — Function
update_userpermission(id::Integer, create_permission::Optional{Bool}, read_permission::Optional{Bool}, update_permission::Optional{Bool}, delete_permission::Optional{Bool})::UpsertResultUpdate a UserPermission.
Arguments
id::Integer: The id of the user permission to update.create_permission::Optional{Bool}: The new create permission.read_permission::Optional{Bool}: The new read permission.update_permission::Optional{Bool}: The new update permission.delete_permission::Optional{Bool}: The new delete permission.
Returns
An UpsertResult. Updated if the record was successfully updated (or no fields were changed), Unprocessable if the record violates a constraint or if no fields were provided to update, and Error if an error occurred while updating the record.
DearDiary.delete_userpermission — Function
delete_userpermission(id::Integer)::BoolDelete a UserPermission.
Arguments
id::Integer: The id of the user permission to delete.
Returns
true if the record was successfully deleted, false otherwise.