Fetch only users and not resources - active-directory

I made a get req to /v1.0/users to fetch users but on the response I got resources too.
{"id"=>"e7cae970-f906-49f9-b080-8ec0b487c999",
"businessPhones"=>[],
"displayName"=>"meeting room 1",
"givenName"=>nil,
"jobTitle"=>nil,
"mail"=>"meetingroom1#test.onmicrosoft.com",
"mobilePhone"=>nil,
"officeLocation"=>"location",
"preferredLanguage"=>nil,
"surname"=>nil,
"userPrincipalName"=>"meetingroom1#test.onmicrosoft.com"},
How can I only list users and not resources?

You can do a couple of things here, but it depends on how resources are defined in your directory. Often times, directory resources (conference rooms, etc) are missing certain properties that are set for actual users, like givenName and jobTitle. You can prune resources missing these properties client-side by iterating through and checking what values are present.
For other Graph resources, you can use OData query options to filter down to just the subset of resources you want. However, support for filtering on properties of users is limited to a few operators like startsWith.

Related

WordPress : make categories automatically match according to external API Value

I'm managing a company website, where we have to display our products. We however do not want to handle the admin edit for this CPT, nor offer the ability to access to the form. But we have to read some product data form the admin edit page. All has to be created or updated via our CRM platform automatically.
For this matter, I already setup a CPT (wprc_pr) and registered 6 custom hierarchical terms: 1 generic for the types (wprc_pr_type) and 5 targeting each types available: wprc_pr_rb, wprc_pr_sp, wprc_pr_pe, wprc_pr_ce and wprc_pr_pr. All those taxonomies are required for filtering purposes (was the old way of working, maybe not the best, opened to suggestions here). We happen to come out with archive pages links looking like site.tld/generic/specific-parent/specific-child/ which is what is desired here.
I have a internal tool, nodeJS based, to batch create products from our CRM. The job is simple: get all products not yet pushed to the website, format a new post, push it to the WP REST API, wait for response, updated CRM data in consequence, and proceed to next product. Handle about 1600 products today on trialn each gone fine
The issue for now is that in order for me to put the correct terms to the new post, I have to compute for each product the generic type and specific type children.
I handled that by creating 6 files, one for each taxonomy. Each file is basically a giant JS object with the id from the CRM as a key, and the term id as a value. My script handles the category assertion like that:
wp_taxonomy = [jsTaxonomyMapper[crm_id1][crm_id2]] // or [] if not found
I have to say it is working pretty well, and that I could stop here. But I will have to take that computing to the wp_after_insert_post hook, in order to reaffect the post to the desired category on updated if something changed on the CRM.
Not quite difficult, but if I happen to add category on the CRM, I'll have to manually edit my mappers to add the new terms, and believe me that's a hassle.
Not waiting for a full solution here, but a way to work the thing. Maybe a way to computed those mappers and store their values in the options table maybe, or have a mapper class, I don't know at all.
Additional information:
Data from the CRM comes as integers (ids corresponding to a label) and the mappers today consist of 6 arrays (nested or not), about 600 total entries.
If you have something for me, or even suggestions to simplify the process, I'll go with it.
Thanks.
EDIT :
Went with another approach, see comment below.

Matomo - how to group different URLs in tracking / how to track moodle course activity?

I have the following challenge:
I have a Moodle system and would like to track visitor activity in the courses via Matomo.
The problem is that one course has several activities, but they are found under a different URL structure.
Example: My course has the URL /course/view=1 and also has a few activities that can be found under three completely different URLs (e.g. /mod/forum/view=20, /mod/feedback/view=7 and so on).
Now I would like to have a common tracking for a course room and the activities in it.
Is this possible? Are there any direct solutions for Moodle? Or how could I do this manually in Matomo?
Thanks
It's possible to set a custom URL in Matomo by using the following code in the page:
_paq.push(['setCustomUrl', 'https://yourdomain.com/your-new-page-url']);
You could perhaps do this for all the pages within a "Course" in order to track all of the actions taken in one logical "Page", but this may affect some of the reports for that page (For example page overlay might be broken)
An alternate way of tracking all of the actions would be to set the Page Title that Matomo tracks using:
_paq.push(['setCustomTitle', 'Your Page Title Here'])
This will allow you to group all of the actions under one logical Page Title under the Page Titles report.

Using ACL on related objects

My app is an angularjs/ionic/parse.com/phonegap one and i am looking for ways to achieve the following.
I have a category within which are articles.
Some categories are open to all users, others are password protected.
Once the user enters the password, they have access to articles within the protected category.
I plan to implement parse.com ACL's but not sure where this should be applied, on the category or the articles. If i apply them to the category and relate articles as arrays, does Parse auto matically implement the ACL to all child articles to which the array points to?

Is this the right db design for the most flexible and modular CMS with user management in CakePHP?

I would like to ask you guys if you could review my database design. I think it is quite self-explanatory, but to be absolutely clear:
My goal is to make an application which has a super flexible user management (which is why the groups are in tree-form and the groups and users have a habtm relationship) and a super modular way to build pages (which is why the pages consist of widget-blocks).
The reason I made users and profiles separate is because the users table will not change and is only needed for authentication and authorization. However, the profiles table will change according to the wishes of the client. So it might not have a signature, but an avatar field instead. Or maybe it will be completely empty / not exist at all.
A widget could be anything, it could be a poll, it could be a piece of content, it could be a navigation, it could be a collection of comments, whatever.
The reason I chose to make subdomains, locales and layouts separate tables instead of just putting the names into pages is because I want to limit the options that are available to the client. Just because I have a three-columns.ctp in my layouts folder doesn't necessarily mean I want the client to be able to choose it.
Same goes for the widgets. And besides limiting choice, not every plugin, controller and action in my plugins-folder is a widget, so I need a table to clarify which are.
A block is a widget on a page which sits in a container (e.g. the right column in a 3 column layout) at a particular position which is decided by the index (lower index means higher).
So that's my explanation, what do you guys think? Is this as good as it can be? Or do you have (a) suggestion(s) to make it even more flexible and modular.
[edit] Oh and to be clear, the widgets will of course have their own tables to store the information they need to store.
Well, I think that everything is great except "profiles".
When you try to get data from a logged user:
$this->Auth->user();
I don't think that you will get data about "profiles" so you will have to find profile by $this->Auth->user('id') etc. I think that you should merge "profiles" and "users" tables into "users" table.
So when you want to save, let's say, "signature" you should just put it in $this->request->data; and call $this->User->save($this->request->data); and the signature will be updated.
EDIT:
You can leave it the way it is but, to get other data than user, you will have to put:
$id = $this->Auth->user('id');
$current_user = $this->User->findById($id);

How can I generate counts for items with differing view permissions in my database without being inefficinet?

My web-app has a media upload facility which associates each uploaded media item with a collection of media items (for simplicity we'll just refer to each group of media items as an album, though the encompassing entity for media items is not as simple a structure). Each of these "albums" has the potential to have custom viewability settings which specify who can view the album (a la Facebook).
I'm trying to generate a count of media items uploaded by a user for display on the user's front page.The problem is, I can't figure out a way to do this without perusing through the data of all the "albums" (in essence, its doing the same amount of work required to collect the viewable albums).
If all the albums had the same viewability settings, I could just maintain a count of the media items and manipulate it on upload & deletion. Since they can potentially all have different viewability settings, however, I have to check the viewability permission of the viewer for each "album" to make sure its media items can be included in the count that will be displayed to him.
Consider Facebook:
Upon looking at a user's profile, you can see a count of photos uploaded by the user. Presumably this count is of all photos you're allowed to view, and not the total count of the user's photos. If this is true, it would be inefficient to peruse through all the album database rows (and rows in other tables, such as those containing the "Lists" of allowed viewers) just to generate a count; you still have another click to get to the page where you can view the photos (where a permission verification process will have to be completed again)!
Is there something I'm missing, or is this now sites handle items like these? Perhaps the process is completed the first time and the viewable albums are cached for subsequent use?
I don't know about Facebook, but... Unless you're doing something extremely complicated with the permissions, if you have a well-normalised database and properly set up indices, the join should not be that slow. Can you show the relevant schemata?
After momentarily blocking a friend from viewing some of my photos, then viewing the profile as him (using the "View as" option) at the top-right corner, it appears as though the photo count doesn't change. In other words, the count is the value of all the photos uploaded by the user, regardless of the privacy settings on each.
I'd be grateful if anyone could confirm this.

Resources