Thread Tools Display Modes
07-15-19, 11:54 PM   #1
Aeriez
A Fallenroot Satyr
Join Date: May 2007
Posts: 24
Check another players permissions

I'm trying to set permissions for certain broadcasts within an addon. C_GuildInfo.CanEditOfficerNote() identifies if the native user is able to edit officer notes. But is there a method/function that can determine if another player in your guild has those permissions? Or is GetGuildRosterInfo rankIndex 0 and 1 the best bet in that case? Have been reluctant to find another method.

Last edited by Aeriez : 07-16-19 at 12:21 AM.
  Reply With Quote
07-16-19, 05:43 AM   #2
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Check https://wow.gamepedia.com/API_C_Guil...olGetRankFlags
Code:
C_GuildInfo.GuildControlGetRankFlags(rankOrder) == 12
  Reply With Quote
07-16-19, 04:31 PM   #3
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
ughh I meant
Code:
if C_GuildInfo.GuildControlGetRankFlags(rankOrder)[12] then
	-- do stuff
end
  Reply With Quote
07-16-19, 08:09 PM   #4
Aeriez
A Fallenroot Satyr
Join Date: May 2007
Posts: 24
Originally Posted by Ketho View Post
ughh I meant
Code:
if C_GuildInfo.GuildControlGetRankFlags(rankOrder)[12] then
	-- do stuff
end
That actually just appears to give rank permissions. I already know Guild Master and Officer ranks have Officer Note permissions. That's implicit. I'm looking more for something that checks if X player has officer note permissions. Not if a specific rank has the permissions. But I suppose I could run multiple functions to determine what ranks grant permissions and then see if the player has that rank. Seems like an awefully round about way to do it though. Was hoping there'd be a DoesPlayerHaveOfficerPermissions("Player name/uuid") sort of thing

Last edited by Aeriez : 07-16-19 at 08:13 PM.
  Reply With Quote
07-16-19, 10:03 PM   #5
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by Aeriez View Post
That actually just appears to give rank permissions.

Just pointing you in the right direction. It's not that much of roundabout way

Lua Code:
  1. local members, ranks = {}, {}
  2.  
  3. local function GetPermissions()
  4.     for i = 1, GetNumGuildMembers() do
  5.         local name, _, rankIndex, _, _, _, _, _, _, _, _, _, _, _, _, _, guid = GetGuildRosterInfo(i)
  6.         members[guid] = rankIndex + 1
  7.     end
  8.     for i = 1, MAX_GUILDRANKS or 10 do
  9.         ranks[i] = C_GuildInfo.GuildControlGetRankFlags(i)
  10.     end
  11. end
  12.  
  13. -- /dump DoesPlayerHavePermissions("target", 12)
  14. function DoesPlayerHavePermissions(unit, flag)
  15.     if IsInGuild() then
  16.         if not next(members) then
  17.             GetPermissions()
  18.         end
  19.         local guid = UnitGUID(unit)
  20.         local member = ranks[members[guid]]
  21.         return member and member[flag]
  22.     end
  23. end

Modify it if you want it to check against names (GGRI includes realm) instead of guids

Last edited by Ketho : 07-16-19 at 10:43 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Check another players permissions

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off