phabricator global email preferences - phabricator

Is there a way to configure global email notification preferences in Phabricator?
I know that it allows to manage the preferences per user (https://secure.phabricator.com/book/phabricator/article/mail_rules/#reducing-email), but I'd like to configure default parameters to be inherited by all new user accounts.
Also it would be great if there is ability to update email notification preferences for existing user accounts in a bulk.

As an admin, go to your Settings and click Global Settings. Change what you want. These will apply to all new accounts.

To update email preferences for all users in a Phabricator instance:
1.run the following SQL script in mysql console:
use phabricator_user;
/*handle users who haven't customized their preferences yet (replace 'test' with name of your model user)*/
insert into user_preferences(userPHID, preferences) select l.PHID, (select p.preferences from user u join user_preferences p on (p.userPHID=u.PHID) where
u.userName = 'test') from user l where not exists(select * from user_preferences r where r.userPHID=l.PHID);
/*change individual parameters for all users*/
update user_preferences set preferences = replace(preferences, '"audit-add-ccs":1', '"audit-add-ccs":2');/*set A commit's subscribers change. to Ignore*/
update user_preferences set preferences = replace(preferences, '"audit-projects":1', '"audit-projects":2');
update user_preferences set preferences = replace(preferences, '"maniphest-priority":1', '"maniphest-priority":2');
update user_preferences set preferences = replace(preferences, '"maniphest-cc":1', '"maniphest-cc":2');
update user_preferences set preferences = replace(preferences, '"maniphest-projects":1', '"maniphest-projects":2');
update user_preferences set preferences = replace(preferences, '"maniphest-unblock":1', '"maniphest-unblock":2');
update user_preferences set preferences = replace(preferences, '"maniphest-column":1', '"maniphest-column":2');
update user_preferences set preferences = replace(preferences, '"maniphest-other":1', '"maniphest-other":2');
/*list current users' preferences*/
select u.phid, u.userName, p.preferences from user u left join user_preferences p on (p.userPhid=u.phid);
2.restart Phabricator daemons and the web server:
./bin/phd restart
service httpd restart
Disclaimer: it worked in my specific case on a specific revision of Phabricator, but it is certainly a "hack" and has a potential to damage user preferences.

Related

How can I get a user role history?

Is there any way to get a user role history? Let's say I added a new user with the role Subscriber. Now I manually updated the role to "Editor", and then "Administrator".
Is there any way to get the history of the user with date/time?
For e.g:
User 1 was a "Subscriber" on 25/01/2023
User 1 updated to "Editor" on 27/01/2023.
User 1 updated to "Administrator" on 29/01/2023.
I know we can fetch the current display role
There's nothing in core WordPress that records this history. There are some popular history plugins you might try. https://wordpress.org/plugins/search/history/
The current role settings for each user are stored in wp_usermeta in an entry with meta_key = 'wp_capabilities'. For example, an editor will have this meta value:
array( 'editor' => true )
Recording changes to those metadata values will give you the history if you decide to do this with your own plugin code. You can hook the 'update_user_meta', 'add_user_meta', and 'delete_user_meta' actions to intercept changes.

WSO2 IS 5.3.0 Unable to change attribute list in user profile

I have setup WSO2 IS 5.3.0 with an Active Directory as secundary user store.
I am able to find users from the AD, and view their user profile in the management console.
I would now like to modify the list of attributes that are displayed in the user profile screen. I already found documentation saying I should edit the corresponding claims, setting the attribute 'Supported by Default' to true for the desired claims, and also setting the desired number in the 'Display Order' attribute. So I modified some local claims, but these changes have no effect on the User Profile screen: I keep getting the same original list of attributes (First Name, Last Name, Organisation, Country, ...). Can anyone tell me what I could be doing wrong ?
The secondary user store is configured with the following settings:
screenshot AD configuration
This is the user profile screen for my user account in the AD.
An example of a claim modification is for the local Country claim where I set the 'Supported by Default' to false and changing the 'Display Order' from 4 to 0. When opening the user profile screen again, the content remains unchanged (country field is still there).
Another example is when I try to add another claim in the user profile screen, such as the local Date of Birth claim, by setting the 'Supported by Default' to true and changing the 'Display Order' from 0 to 4. Again, nothing changes in the user profile screen either (date of birth field is not present).
For the Organisation claim that is present in the user profile screen, but that is currently empty, I added an attribute mapping to the 'company' attribute that exists in the AD, but when looking at the user profile screen again, this field remains empty.
Let me know if any further details are needed (I would have added some more screenshots, but as a new user on this forum, I'm currently limited to 2 links in my posts...).
In the end, I did a complete reinstallation (including setting up an oracle DB as carbon DB instead of the H2 DB), and this time everything works correctly. Something must have gone wrong during the first installation.

Importing CSV file in Drupal using Migrate module. Want nodes to be owned by admin

When importing using the drush migrate-import command, all nodes created are owned by anonymous. I would like them to be owned by the admin user or some other user.
If you're using the GUI to import by .CSV, you may need a custom script like the one suggested above.
The more flexible way is to use the migrate module(newet version), and set up a migration class and where you perform mappings, do this.
<code>
<?php
$this->addFieldMapping('uid')->defaultValue('1');
?>
</code>
The default value of '1' should be the UID of whatever the user you want to be the author.
Make sure you look at the included beer and wine migration examples the come with the module
There are several ways to go about this but this is probably the quickest:
On the mysql command line, or drush sqlc, find the highest node id before importing:
SELECT MAX(nid) FROM node;
Import your nodes.
Find the uid of the user you want to set the owner to.
SELECT uid FROM user WHERE name = 'Admin';
Issue an update query to bulk update the nodes:
UPDATE node SET uid = x WHERE nid > y;
Where x = uid of admin user, and y = max nid+1

problem in viewing others user profile (asp.net )

i am creating site like say LinkedIn/spoke
like when i login ,i give my login id and password so database
checks it and allow me to access my profile
i need to know that in stackoverflow when we click to users
button all the users in stackoverflow are shown
but when i click to specific user
how does the database known that this specific user is clicked
and show's his/her profile data ?
should i create new page for viewing others user profile ?
and if i do so what will be the query for that
If you have 2 seperate queries then it makes easier (I'm not saying this is the best solution). So, you could have a 'select all users' query which could be something as simple as :
SELECT *
FROM MyUsers
This will return all of your users to your website, so you can view them. Then, when you select a user from your website, you call a different query, say 'select a single user', and pass a parameter from your website. The query could look something like :
SELECT *
FROM MyUsers
WHERE UserID = #UserID
This could be done in one stored procedure and test if your #UserID is NULL then run the required SELECT statement.

User configurable security in multi-tenant ASP.NET website

We are building a multi-tenant website in ASP.NET, and we must let each customer configure their own security model. They must be able to define their own roles, and put users in those roles. What is the best way to do this?
There are tons of simple examples of page_load events that have code like:
if (!user.InGroup("Admin")
Response.Redirect("/NoAccess.aspx");
But that hard codes the groups and permissions in the code. How can I make it user configurable?
Perhaps put the configurable roles in a DB table, where you store the roles and tenant, and then the PagePermissions in another table, for example:
Table "Role"
RoleId, TenantId, Role
Table "PagePermissions"
PageId, RoleId
Table "UserRoles"
UserId, RoleId
Then in the page load check whether the User is in a RoleId that has permissions for that page, for example:
Select PageId FROM
UserRoles UR INNER JOIN PagePermissions PP
ON UR.RoleId = PP.RoleID
WHERE UR.Userid = #UserId AND PP.PageID = #PageId
If there are no rows returned then deny the user.
I would create a configuration system for the website that is easily managed in config-files. Where you could get typed members and use like this.
foreach(var group in ThisPageConfiguration.AcceptedRoleNames)
if (user.IsInRole(group))
...
Each customer could then configure their site in their configuration files... And every other type of things you'd want to configure.

Resources