Database Role based access control design for survey app

I’m going to design the RBAC for a survey app. Each survey has the same role as below and only 1 manager, 1 leader and multiple participants.

Role_ID|Role_Name  | -------|-----------|       1|admin      |       2|manager    |       3|leader     |       4|participant| 

Each user can have multiple roles and this user can choose to be the participant role to join one survey or not when he is the manager or leader of a survey. To make the user only can action the survey he owns, for example, UserA is assigned to be the leader of SurveyA, so he can only has the capability, edit_survey, on SurveyA but not another surveyB which he’s not assigned to, how should I design the database?

I generated two options, can someone check which one is better or there is another better solution?

Option1

I put the role manager and leader column as the FK of User_ID from User table on Survey table as it’s one to one relationship and create a new participant table for participants.

enter image description here

Option2

I create a new user_role_in_survey table to store manager and leader role and this table replaces old user_role table. Survey_ID is the FK of Survey table and participant table for participants.

enter image description here

First time role playing, how to I address this problem?

So I am brand new the role playing as I am really shy and normally don’t like to tell my stories to other. I am role-playing with my friend and her siblings and I have a problem. I have added my character into an already existing, huge lore, place. And my friend is trying to make my character do things that would not fit my narrative. For example my character has a boyfriend and this guy is very specific to her background as they are kinda tied together by fate through different lives. Every time my OC dies, she will meet her boyfriend in the next universe, her could be her lover, friend, or enemy. My friend forced me to break up with the OC’s boyfriend and now is trying to forcefully get my OC to date a girl. I told her this character is strictly heterosexual and honestly is really mainly attracted to her boyfriend but my friend will not listen. I have other OCs who are LGBTQA+, but she is so admit on the straight one. I don’t want to cause trouble but they are constantly forcing my OC to do things out of character that I have created because she is my character. And I don’t know what to do? I don’t want to be mean or cause drama but I am stuck!

GRANT ROLE TO USER in MySQL

I created one role QI_RO, granted all privileges on all schemas on the server and I was trying to grant role privilege to another user but throwing error.

GRANT QI_RO to test_user@'%'; 

Error Message:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'QI_RO to test_user@'%'' at line 1  

DB version:

mysql> select version(); +-----------+ | version() | +-----------+ | 5.6.10    | +-----------+ 1 row in set (0.00 sec) 

How to grant role privileges to users in Mysql like other databases, Postgres and oracle?

Thanks

I am looking for a game to ease my friends into role playing [closed]

Let me start with saying it’s been many years since I played D&D. I have a group of friends that meet every week to play board games like Descent, Heroquest, etc. The thing is, none of these friends have any experience with role playing, as you probably know, the idea of acting like they are the character is hard to overcome at first. Not to mention, their imaginations are definitely out of practice.

I know there are a lot of new games out, ones that have tiles, cards, etc, but still allow you to role play. I figure something like this would help ease them into the genre. At least this way, they wouldn’t have to imagine every little detail right off the bat.

If you have any suggestions, please let me know. I would greatly appreciate it. Thanks for your time.

Role of games within games

Sometimes my players want to engage in gambling or other games of chance within the role-playing game itself (I know, vaguely meta). The question is two-fold:

  1. How can I approach this without squashing their aspirations to be the next Poker King, indulge them, and not have it become an obsession or throw off game balance due to poverty and/or extreme wealth given their current place in the world?

  2. Does anybody have any good, easy/quick games that could be played in a casino/gambling-hall type locale? I’m thinking something similar to Dragon Dice, an older, briefly manufactured dice game. It should have a fantastical element but be simple enough to learn within 15-30 minutes. I’m not looking to play craps at the gaming table, but having a few alternatives should wet the party’s thirst for casino-style action.

Importantly, I want to avoid a Chocobo-racing scenario (I’m referring to Final Fantasy 7 wherein players would become immersed in breeding and racing wingless birds, rather than actually spending time winning the game).

Woocommerce, If Purchase more then 9, change Role!

I got this code and its working great.

    add_action( 'woocommerce_order_status_processing','change_role_on_purchase' );     function change_role_on_purchase( $  order_id ) {       $  order = wc_get_order( $  order_id );       $  items = $  order->get_items();       $  products_to_check = array( '2205','2207','2209','2211','2213','2226','2227','2230','2450','2444','2235','2237','2238','2239','2240'  );       foreach ( $  items as $  item ) {         if ( $  order->user_id > 0 && in_array( $  item['product_id'], $  products_to_check ) ) {             $  user = new WP_User( $  order->user_id );             // Change role             $  user->remove_role( 'Customer' );             $  user->add_role( 'Distributor' );             // Exit the loop             break;         }     } } 

But, I want to add:- If user purchase more than 9, change role to Distributor.

Group with split likes in DnD game: role playing and combat

I’m running a game for 4 people, 1 of which has played DnD before. I have only ran a 1st session. This session lasted for about 5 or 6 hours, and it seems that it was a lot of fun for them. I will run the "Dragon of Icespire Peak" campaign, but haven’t even started the 1st town or quests.

At the end, one of the people told me that he basically enjoyed substantially more the role playing than the combat. Almost as if he disliked the combat (he is a half elf warlock drag queen with a very interesting back story). From his interaction with the group, it was clear that he loves role playing, he acts it all out, and it is great fun for everyone when this happens. But the others also like fighting.

So I’m wondering how you would go about making it fun for everyone in this way? What to do in this situation? I understand that the obvious answer is "Run a story driven campaign with a few combats here and there", but perhaps there is better solution?

How do I code access to the built-in UI of a CPT when it’s placed as submenu of another CPT that is protected by role?

I am toying around with WordPress capabilities, and having some difficulty understanding where I am going wrong. Right now, I have an admin menu that appears for all administrators with STUDENTS as a submenu of SCHOOL: each of those link to http://example.com/wp-admin/edit.php?post_type=student. (When the user is in the HEADMASTER role, the link to the built-in UI for TEACHER appears and SCHOOL mimics its link). So far, all is well.

The bump in the road is when a non-HEADMASTER administrator clicks either SCHOOL or STUDENTS, the error “Sorry, you are not allowed to access this page” appears. (As expected, when that same admin accesses http://example.com/wp-admin/edit.php?post_type=teacher, the errors “You need a higher level of permission” and “Sorry, you are not allowed to edit posts in this post type” appear.) The issue is that the STUDENTS built-in UI is not accessible to all administrators. (As expected, there are no problems for HEADMASTERs.) How can this be resolved in such a way as to give all site admins access to STUDENTS and only HEADMASTERs access to TEACHERS while at the same time preserving the layout and functionality of the admin menu and built-in UI?

What I’ve Tried: When the 'show_in_menu' => 'edit.php?post_type=teacher' line is removed from the STUDENTS CPT, everything works as expected but STUDENTS becomes a top-level menu item instead of SCHOOL. I tried putting TEACHERS as a sub-menu item as STUDENTS, but SCHOOL does not change its link when the user is in the HEADMASTER role (also the ordering of TEACHERS and STUDENTS is backwards). I also tried add_menu_page() for SCHOOL and adding the slug returned for the show_in_menu argument of the TEACHERS and STUDENTS register_post_type args, respectively, but that didn’t work because it created a page instead of forwarding to the appropriate built-in UI.

 class School {     public static function init() {         add_action('init', array(__CLASS__, 'register_cpt'));         add_action('init', array(__CLASS__, 'add_role'));         add_action('admin_menu', array(__CLASS__, 'modify_menu'));     }      public static function register_cpt() {         register_post_type('teacher', array(             'labels' => array(                 'name'          => __('TEACHER'),                 'all_items'     => __('TEACHERS'),                 'menu_name'     => __('SCHOOL'),             ),             'show_ui'           => TRUE,             'capability_type'   => 'educator',             'map_meta_cap'      => TRUE,         ));         register_post_type('student', array(             'labels' => array(                 'name'          => __('STUDENT'),                 'menu_name'     => __('STUDENTS'),             ),             'show_ui'           => TRUE,             'show_in_menu'      => 'edit.php?post_type=teacher',         ));     }      public static function add_role() {         if(get_role('headmaster') === NULL) {             $  caps = array();             foreach(get_role('administrator')->capabilities as $  cap => $  tmp) {                 $  pos = strpos($  cap, 'post');                 if($  pos !== FALSE) {                     $  cap = str_replace('post', 'educator', $  cap);                     $  caps[$  cap] = TRUE;                 }             }             add_role('headmaster', 'HEADMASTER', $  caps);         }     }      public static function modify_menu() {         global $  submenu;         unset($  submenu['edit.php?post_type=teacher'][10]);     } } School::init(); 

Role playing games with no humans [closed]

Because of story setting no humans should be available as playable entities, instead other creatures some of which might look or resemble humans and some of which are not even humanoid are playble.

This however puts some worries on me, is anyone even gonna play my game? As far as I know all famous rpg’s game have humans as playable characters and its common that humans are also the most played entity in such games.

Should I just change my games lore and avoid wasting my time?

Gutenberg Featured-Image-panel missing when user with custom role edits Custom Post Type

For a WordPress project I made a Custom Post Type in the usual manner. Also i made a custom role. I want users with that role to be able to make, edit and delete this CPT. I added the apropriate capabilities to this role. These are the caps:

'level_1' => true, // seems necessary to asign this author as a post_author by other users 'read' => true, 'view_admin_dashboard' => true, 'upload_files' => true, 'publish_{my_cpts}' => true, 'edit_{my_cpts}' => true, 'edit_others_{my_cpts}' => false, 'delete_{my_cpts}' => true, 'delete_others_{my_cpts}' => false, 'read_private_{my_cpts}' => true, 'edit_{my_cpt}' => true, 'delete_{my_cpt}' => true, 'read_{my_cpt}' => true 

I map these capabilities also in the args for adding the cpt. Upon making the CPT, I did not forget to add ‘thumbnail’ to the ‘supports’ argument. And i added theme-support for thumbnails, also for my cpt

However, i don’t want users with this role to be able to edit ordinary posts.

I think i don’t need to provide more details on this because everything works fine.

Except for the featured image panel in Gutenberg. This panel seems to display only if a user has the edit_posts capability, which my users don’t have. The panel shows for other users, it only remains hidden for users with my custom role.

For now, I made a workaround with an ACF-image field. Images uploaded with this custom field I make the featured-image in a save_post hook.

But this is a workaround, I prefer the usual panel. Any suggestions? I find this an unusual hard nut to crack.