18 #include "roleacl_p.h"
22 #include <Cutelyst/Plugins/Authentication/authentication.h>
23 #include <Cutelyst/Controller>
24 #include <Cutelyst/Dispatcher>
132 return AroundExecute;
138 Q_UNUSED(application)
144 qFatal(
"RoleACL: Action %s requires at least one RequiresRole or AllowedRole attribute", qPrintable(d->actionReverse));
147 for (
const QString &role : required) {
148 d->requiresRole.append(role);
152 for (
const QString &role : allowed) {
153 d->allowedRole.append(role);
157 auto it = attributes.constFind(
QLatin1String(
"ACLDetachTo"));
158 if (it == attributes.constEnd() || it.value().isEmpty()) {
159 qFatal(
"RoleACL: Action %s requires the ACLDetachTo(<action>) attribute", qPrintable(d->actionReverse));
161 d->aclDetachTo = it.value();
188 if (!required.isEmpty() && !allowed.isEmpty()) {
189 for (
const QString &role : required) {
195 for (
const QString &role : allowed) {
200 }
else if (!required.isEmpty()) {
201 for (
const QString &role : required) {
207 }
else if (!allowed.isEmpty()) {
208 for (
const QString &role : allowed) {
223 d->detachTo = controller->
actionFor(d->aclDetachTo);
227 qFatal(
"RoleACL: Action '%s' requires a valid action set on the ACLDetachTo(%s) attribute",
228 qPrintable(d->actionReverse), qPrintable(d->aclDetachTo));
235 #include "moc_roleacl.cpp"