Commit 332be753 authored by jan.koester's avatar jan.koester
Browse files

tes

parent 586acc43
Loading
Loading
Loading
Loading
Loading
+1 −22
Original line number Diff line number Diff line
@@ -296,29 +296,8 @@ public:
                        user.info(_Backend, *udat, upos);

                        if (constant_time_eq(pwsalt, udat->getPwHash())) {
                            // If no domain specified (admin path), restrict to SuperAdmins
                            // and assign them to the "admin.local" domain
                            // If no domain specified (admin path), assign "admin.local" domain
                            if (_Did.empty()) {
                                // Check SuperAdmin group membership
                                Group group;
                                std::vector<uuid::uuid> gids;
                                group.list(_Backend, gids);
                                bool isSuperAdmin = false;
                                for (auto &gid : gids) {
                                    std::shared_ptr<GroupData> grpi =
                                        std::make_shared<GroupData>(gid);
                                    size_t gpos = sizeof(AuthHeader);
                                    group.info(_Backend, *grpi, gpos);
                                    if (grpi->getName() == "SuperAdmin"
                                        && grpi->isMember(found_uid)) {
                                        isSuperAdmin = true;
                                        break;
                                    }
                                }
                                if (!isSuperAdmin)
                                    return nullptr; // not a SuperAdmin

                                // Resolve "admin.local" domain
                                RecordIndex &didx = _Backend.getIndex();
                                if (!didx.valid() || didx.revision() != _Backend.getRevesion())
                                    didx.build(_Backend);