Openstack "_member_" role and "Member" role - openstack

Recently, I study Openstack Keystone. When I do
keystone role-list
I found three roles . They are
+----------------------------------+---------------+
| id | name |
+----------------------------------+---------------+
| cb362e8e96464f9980c232dfd56d2ff5 | Member |
| d4218b8761844a70ab4fab54cc3afaf9 | ResellerAdmin |
| 9fe2ff9ee4384b1894a90878d3e92bab | _member_ |
| 70340c7de4024ffbbbdd15ae9ebbbe83 | admin |
+----------------------------------+---------------+
I know the "admin role" is the highest role. But I don't know what the differences between "Member" ,"member" and "ResellerAdmin". Could someone help me ??Thanks a lot !

Here are a few references that could answer your question:
ResellerAdmin and admin:
https://github.com/openstack-dev/devstack/blob/master/files/keystone_data.sh#L44-L50
_member_:
https://github.com/openstack/keystone/blob/5152f12fc9ff14df0bdff5d7840da81318622c00/etc/keystone.conf.sample#L30-L36

_ member_ is the default role that is assigned to users when they are created. The other roles listed above seem to be from your devstack instance. Basically, we just have 2 default openstack roles that gets configured: admin and _ member_. To distinguish member and Member in your instance, try https://ask.openstack.org/en/question/4759/member-vs-member/ .

Related

Best way to define data structure in firebase database

I'm not sure that is the best way to define the following use case in firebase database. The app has the following structure.
STUDIO - Container
ADMIN - can create, read and update Trainers and Members
TRAINER - can create, read and update members
MEMBER - can signup, read and edit own data
Important ADMIN, TRAINER, MEMBER are all users who can login.
Where I should save the relationship form TRAINER to STUDIO, MEMBER to STUDIO and ADMIN to STUDIO.
|____firebase
| |____studios
| | |____Studio_A
| | | |____trainers
| | | | |____Trainer_B
| | | | |____Trainer_A
| | | |____Administrator
| | | |____members
| | | | |____Member_B
| | | | |____Member_C
| | | | |____Member_A
The structure looks quite good to me. What you'll need to add is something like a users node.
Like this:
- studios
- studio-1
- trainers
- userid
- admin
- userid
- members
- userid
- users
- userid
- studios
- studio-1: "member"
- name // just an example property
- age // just an example property
If a user can have mulitple roles in one studio, you would need to create an array inside the studios node.

How to set firebase-database rule so users can read each other's data iff they share a group

I have a chat-like realtime database with the following design
groups-
|
[groupId1]-
|
users-
|
[uid]
....
[groupId2]-
|
users-
|
[uid]
....
users-
|
....
[uid]-
|
groups-
|
[groupId1]
[groupId2]
I want to set up Rules so user1 can ".read" data from users/user2 iff they share at least one group.
The data structure is such that i need every user can be in numerous groups so the users data must be under users/uid node and cannot be duplicated to every groups/[groupId]/users/[uid]
Any ideas?
You can find the answer to your question here with the Chat Example : https://firebase.google.com/docs/database/security/user-security#section-revisiting-advanced-example

What are Personal Translations in Gedmo Doctrine Extensions?

In the Translatable behaviour of the Gedmo Doctrine Extensions, it has instructions on "Personal Translations". Could someone clarify what personal translations are?
tl;dr
Personal translations are used when you want to handle the translation entity (with it's own table by yourself) instead of the default behaviour, by using a single table for all translations.
By using the default behaviour, you get a single table called ext_translations which holds all of your translation data. I'll give you an example based on the documentation of DoctrineExtensions.
Let's say we create an Article entity with 2 translatable fields - title and content. That would mean that we should have the following table structure of articles:
+----+-------+---------+
| id | title | content |
+----+-------+---------+
Now, by default the TranslatableListener sets en_us locale every time you create new entity, thus populating only articles table:
$article = new Article();
$article->setTitle('Title english');
$article->setContent('Content english');
Would lead to the following:
+----+---------------+-----------------+
| id | title | content |
+----+---------------+-----------------+
| 1 | Title english | Content english |
+----+---------------+-----------------+
By now, only articles get to be updated with new records, but when you want to translate those fields with different locale, our common table ext_translations get updated as well.
The table has the following structure:
+----+--------+---------------+---------+-------------+------------+
| id | locale | object_class | field | foreign_key | content |
+----+--------+---------------+---------+-------------+------------+
So, what happens when we update our record with some new translations:
$article->setTitle('My title');
$article->setContent('My content');
$article->setTranslatableLocale('de_de');
When we persist our updated entity, we get the following structure in ext_translations:
+----+--------+---------------+---------+-------------+------------+
| id | locale | object_class | field | foreign_key | content |
+----+--------+---------------+---------+-------------+------------+
| 1 | de_de | Bundle\Entity | title | 1 | My title |
| 2 | de_de | Bundle\Entity | content | 1 | My content |
+----+--------+---------------+---------+-------------+------------+
Now you know how the default behaviour works. It stores all of your translations (not just for single entity, all of them) in a single table.
But when you're using a personal translations you can store your (let's say for the sake of our example) Article translations to its own, separate table, article_translations.
If you are familiar with DoctrineExtensions provided by KnpLabs, then you've already seen what stands for PersonalTranslations. Link for their documentation about this subject can be found here.
Well hopes this can clarify things a bit for you. Let me know if you have more questions about this.

SonataAdmin - Choice field from non managed entity

Imagine a user who is linked to a company:
User
- id
- username
- company_id
The company list comes from a procedure call (external db), no hands on the related table
EXEC getCompanies;
+----+-------+
| id | name |
+----+-------+
| 1 | comp1 |
| 2 | comp2 |
| 3 | comp3 |
+----+-------+
How would you integrate this to allow SonataAdmin to render a proper input selection for company in User editition, and display the company name in User list ?
Do you know where I could find some examples about this particular case ?
I did a custom company field type which fetchs his values from the procedure call, but I'm not sure it's the best idea and I'm not able to display the comany name in the list.
You could use a choice type and if there are too many companies to display, you can use GenemuFormBundle with Select2 library to have filtering select widget.

Drupal 7: creating custom content block

I'm new to Drupal and am trying to embed a Flash game in the middle of the front page. I've created a "Full HTML" text format in Home >> Administration >> Configuration >> Content authoring and I've created a new block using that format by going into Home >> Administration >> Structure >> Blocks and placed it into Content region and display it at the <front> page only:
My problem is that I need to pass the user id and also a custom gender field to the swf file through the FlashVars parameter.
I can see my gender field in the database (I use PostgreSQL 8.4.7/CentOS 5.5/PHP 5.3):
# select * from field_data_field_gender;
entity_type | bundle | deleted | entity_id | revision_id | language | delta | field_gender_value
-------------+--------+---------+-----------+-------------+----------+-------+--------------------
user | user | 0 | 6 | 6 | und | 0 | Male
user | user | 0 | 5 | 5 | und | 0 | Male
user | user | 0 | 1 | 1 | und | 0 | Male
user | user | 0 | 7 | 7 | und | 0 | Female
And I see the users table:
# select uid, name from users;
uid | name
-----+-------
5 | Vasja
6 | Vanja
1 | Alex
0 |
7 | Petja
But how could I print them into my custom content block?
I also suppose there is already some prefilled data structure there, something like a $user array?
Please give me a bit help and directions to get me running on custom blocks.
I'm looking at the docs, but they're talking about custom modules, which is probably a bit overkill in my case?
And also I need to print a message to the Anonymous user telling him or her to sign in or register. Please give me a pointer here
Thank you!
Alex
P.S. My understanding is that swfobject isn't working well with Drupal 7 yet, but that is not a big issue for me.
It sounds like you want to be able to execute PHP code in your block's content. The Full HTML filter mode is not sufficient for that. Take a look at the PHP Filter module. It's included in core, but needs to be activated first, before you can use it for your block.
After that you can use normal PHP code, at which point the documentation on custom modules applies. You could for example access the $user array to retrieve fields, or make direct db calls, depending on where your required information is.
Edit: Of course, having full PHP access is powerful and should only be allowed for administrators. Hence, make a new specific content type in which you allow the PHP filter and ensure in the permissions that no user other than an administrator can create or edit that content type.

Resources