Can't change user role

Hello!
I created a lua script in which I installed a new role for the current user.

    local affiliation = "member"
    local context_user = event.origin.jitsi_meet_context_user

    if context_user then
        if context_user["affiliation"] == "owner" then
            affiliation = "owner"
        elseif context_user["affiliation"] == "moderator" then
            affiliation = "admin"
        end
    end

    module:log(LOGLEVEL, "affiliation: %s", affiliation)
    room:set_affiliation(true, occupant.bare_jid, affiliation)

In fact, I can only set the owner role. For all other roles I get “none” when I check on the client in the “JitsiConferenceEvents.USER_ROLE_CHANGED” event.

There is no affiliation such as admin. Check this

Thanks for the answer. I tried to set as “publisher”, “member”, “outcast” but I get the changes to “none” in the client.

It’s not possible to use some affiliations in some circumstances and some affiliations don’t be supported by some XMPP implementions. Check this

So only one role is supported? I mean “owner” and “none”.
2020-11-12T07:57:47.616Z [conference.js] <a.>: My role changed, new role: none

And outcast to kick the user.
According to my tests outcast is better than none in many cases

so what roles can I set at all?

owner, member, outcast

FTR you are linking to a section about roles, not affiliations. Jitsi lua code can be very confusing about this distinction.

doesn’t work, i try to set “member” and get “none”

I linked it to refer how the affiliation is affected by the roles & room types. There are some tables in refered topic related with this issue

I found out that I can set “affiliation” to states “outcast”, “admin”, “member”, “owner”. But the client still gets the “none” role.

My role changed, new role: none