User Tag List

Page 1 of 3 1 2 3 LastLast
Results 1 to 7 of 19

Thread: Explaining the RBAC system

  1. #1
    Founder <span style='color: #FF4500'>Tommy</span>'s Avatar
    Join Date
    Apr 2013
    Posts
    7,391
    XP
    3,449,104
    Level
    378
    Thanks
    889
    Thanked 1,856 Times in 1,119 Posts

    Explaining the RBAC system

    Hello guys! It comes to my attention that people are having difficulties trying to communicate with this RBAC system that shouldn't have been implemented because it generates more support! Anyway, let's begin, shall we?

    Contents:


    • 1. Understanding the commands and tables
    • -1.1. List of the Permissions / Other - SQL Structure of all the RBAC tables (DEFAULT)
    • -1.2. Knowing your configuration
    • 2 Giving GM Permissions
    • 2.1 Giving Full Administrator permissions
    • 2.2 Explaining rbac_linked_permissions


    BEFORE CONTINUING:
    Make sure you HAVE all of the data you're suppose to have in each table besides rbac_account_permissions. If you're missing table data, make sure the queries actually went through and didn't error



    ~ List of the Permissions / Other - SQL Structure of all the RBAC tables (DEFAULT) ~

    TrinityCore's RBAC (wiki) documentation:

    http://collab.kpsn.org/display/tc/RBAC%3A+Role+based+Access+Control

    TrinityCore staff has been updating this shit system so bare with me if this is outdated. If this is outdated, post in this thread or make a new thread in the support regarding if it is outdated.

    ~ Understanding the commands and tables ~

    This is rather simple, so let's start off with the tables before heading into the commands right away.

    You should have the following tables:



    • rbac_account_permissions -- Holds data of accounts that have permissions
    • rbac_permissions -- Holds data of permission Id/Names
    • rbac_default_permissions -- Holds data of default permissions
    • rbac_linked_permissions -- Holds data of linked permissions for other permissions to access



    Now, the main tables that you will be inserting data into are (by default if you don't have custom commands):

    rbac_account_permissions

    The rbac_permissions holds all the permissions for you to access in "rbac_account_permissions". However, if you're wanting to make a custom command or a default permission setup, you have to edit rbac_default_permissions with the default permissions and rbac_linked_permission with the new default secID you made and link permissions you want to it.


    (NOTE): You can select a player ingame and type in these commands to view their groups/permissions/roles without specifying their account name.

    .: KNOWING YOUR COMMANDS :.

    The main commands you'll most likely use are:

    rbac account
    rbac account list
    rbac account grant
    rbac account deny
    rbac account revoke
    rbac list

    To see the command arguments, see cs_rbac.cpp for the correct syntax.

    (NOTE): You can select a player ingame and type in these commands to assign their groups/permissions/roles without specifying their account name.

    ~ Giving GM Permissions ~

    NOTE: Make sure you add the account's security type in the account_access table.

    Now, I tested with this and came up with the results. To give a GameMaster Player, Moderator and GM Permissions, you will need to set their groups, permission (Specific commands only) and role. Don't get me wrong, it works perfectly.

    To do this, we'll use a basic SQL query.

    .: By SQL Query :.


    NOTE: Look in rbac_default_permissions for the default permissions.

    To grant your GameMaster permissions do:

    Code:
    INSERT INTO `rbac_account_permissions` (`accountId`, `permissionId`, `granted`, `realmId`) VALUES
    ('2', '193', '1', '-1');
    YOU CAN REPLACE THE VALUES WITH YOUR OWN. THEY ARE SPECIFIC AND CAN EASILY BE CHANGED.


    ~ Giving Full Administrator Permissions (All commands) ~
    NOTE: Make sure you add the account's security type in the account_access table.
    NOTE:
    Look in rbac_default_permissions for the default permissions.

    To do this, we'll use a basic SQL query
    .

    .: By SQL Query :.

    Code:
    INSERT INTO `rbac_account_permissions` (`accountId`, `permissionId`, `granted`, `realmId`) VALUES
    ('2', '192', '1', '-1');
    YOU CAN REPLACE THE VALUES WITH YOUR OWN. THEY ARE SPECIFIC AND CAN EASILY BE CHANGED.


    ALWAYS REMEMBER: -1 is ALL REALMS. You can set permissions to a specific realm, for example 1, 2, 3, etc.. (RealmID goes by the amount of realms you have.)

    ~ Explaining rbac_linked_permissions ~
    If you have a new custom permissionID or you want to edit an existing permissions linked permissions -- then this is what this table is for.

    FOR EXAMPLE:
    If I wanted let's say permissionID 199 (Player Commands) to have the permission 672, I would do this:

    Code:
    INSERT INTO `rbac_linked_permissions` (`id`, `linkedId`) VALUES (199, 672);
    When I query that above to my DB, I linked permissionID (Player Commands) with 672. That means permission 199 Player Commands will have the command: reload npc_trainer. This is only an example, you don't really want to give the player command permission that command. :P

    So, it makes sense, right? You link each permission in `linkedId` you want a permission to have.


    I hope you enjoyed this guide on how to fully comprehend the RBAC system.
    Last edited by Tommy; 01-23-2014 at 05:21 AM.
    Achievements:
    Got a Sticky! Referrer 1 year registered Member Level XL Level C Conversationalist
    Awards:
    Member of Staff Support Smartass LOL Scripter Repacker Most Posts Facepalm! Average Top Discussion Ender Drunk

  2. The Following 14 Users Say Thank You to Tommy For This Useful Post:


  3. #2
    Original Poster
    Founder <span style='color: #FF4500'>Tommy</span>'s Avatar
    Join Date
    Apr 2013
    Posts
    7,391
    XP
    3,449,104
    Level
    378
    Thanks
    889
    Thanked 1,856 Times in 1,119 Posts
    Updated the color crap.

  4. #3
    Retired Staff <s><span style='color: #006400'><span class='glow_006400'>Jameyboor</span></span></s>'s Avatar
    Join Date
    Apr 2013
    Location
    The Netherlands
    Posts
    768
    XP
    300,391
    Level
    116
    Thanks
    230
    Thanked 164 Times in 112 Posts
    Looks colorful
    Achievements:
    Shopper Referrer 1 year registered Member Level XL Level C
    Awards:
    Member of Staff Support Smartass LOL Scripter Facepalm! Raffle Winner
    You miss 100 percent of the shots you never take.

  5. #4
    Exalted Member <span style='color: #000000'><span class='glow_4169E1'>Skrbx</span></span>'s Avatar
    Join Date
    Aug 2013
    Posts
    506
    XP
    2,646,164
    Level
    311
    Thanks
    87
    Thanked 72 Times in 63 Posts
    Nice tut.

  6. #5
    Original Poster
    Founder <span style='color: #FF4500'>Tommy</span>'s Avatar
    Join Date
    Apr 2013
    Posts
    7,391
    XP
    3,449,104
    Level
    378
    Thanks
    889
    Thanked 1,856 Times in 1,119 Posts
    UPDATED with the latest TrinityCore changes!

  7. #6
    Exalted Member Hamar's Avatar
    Join Date
    Apr 2013
    Location
    Finland
    Posts
    484
    XP
    310,635
    Level
    117
    Thanks
    87
    Thanked 70 Times in 52 Posts
    Thanks for the tutorial \o/

  8. #7
    Original Poster
    Founder <span style='color: #FF4500'>Tommy</span>'s Avatar
    Join Date
    Apr 2013
    Posts
    7,391
    XP
    3,449,104
    Level
    378
    Thanks
    889
    Thanked 1,856 Times in 1,119 Posts
    Quote Originally Posted by Hammer View Post
    Thanks for the tutorial \o/
    If only you wrote that 5 months ago when I created the thread. :/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •