After setting
$wgGroupPermissions['*']['read'] = true;
$wgGroupPermissions['*']['edit'] = false;
$wgEmailConfirmToEdit = true;
anonymous users can't edit any page because each time they are asked to confirm their E-mail address.
I want to add one more condition that only administrator can confirm new users. How to do this ?
Anonymous users can't edit pages using the setup you describe because you have specifically disabled their editing permissions by setting: $wgGroupPermissions['*']['edit'] = false; .
It sounds like what you want to do is create a new group with editing permissions and then have administrators add users to that group when they have confirmed the user instead of using email confirmation. So for example:
$wgEmailConfirmToEdit = false;
$wgGroupPermissions['*']['read'] = true;
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['user']['edit'] = false;
$wgGroupPermissions['confirmeduser']['edit'] = true;
Then an administrator can add users to the confirmeduser group to give them editing permissions.
Related
I wanted to know how long does a file in google drive service account stay?
I couldn't find its default expiration time. As I don't have control over the account, how can I know the file is deleted or if no way, Do I have to delete the files from service account myself?
since you don't have control over the account, I don't see how you can actually delete the files owned by that account. the file will stay there as long as the owner not deleting it.
https://support.google.com/drive/answer/2375102
Put a file in trash
To remove a file from your Drive, you can put it
in your trash. Your file will stay there until you empty your trash.
If you're the owner of the file, others can view it until you
permanently delete the file. If you're not the owner, others can see
the file even if you empty your trash.
It is the same how a user creates a file (no expiration date). To know any changes like if it is deleted, you can check the Change Feed to retrieve the changes.
Changes: list
Lists the changes for a user.
Detect Changes
For Google Drive apps that need to keep track of changes to files, the Changes collection provides an efficient way to detect changes to all files, including those that have been shared with a user. The collection works by providing the current state of each file, if and only if the file has changed since a given point in time.
You can delete the files using the Service Account given that it is the owner of the file. You can also check this SO question regarding how to check if a file/folder is deleted.
The files are there to stay until you delete them yourself.
You can always get the file list from the google drive API (I use V3) and get the files list with their ID and delete whichever you want. You can't yet do it via web interface.
Below is an example is c# on how to get the files list:
public List<Google.Apis.Drive.v3.Data.File> GetFilesList(string SearchQ = null)
{
List<Google.Apis.Drive.v3.Data.File> ListOfFiles = new List<Google.Apis.Drive.v3.Data.File>();
FilesResource.ListRequest listRequest = _CurrentDriveService.Files.List();
listRequest.PageSize = 1000;
if (SearchQ != null)
{
listRequest.Q = SearchQ; //("'PARENT_ID' in parents");
}
listRequest.Fields = "nextPageToken, files(id, name,parents,mimeType,size,capabilities,modifiedTime,webViewLink,webContentLink)";
FileList fileFeedList = listRequest.Execute();
while (fileFeedList != null)
{
foreach (File file in fileFeedList.Files)
{
ListOfFiles.Add(file);
}
if (fileFeedList.NextPageToken == null)
{
break;
}
listRequest.PageToken = fileFeedList.NextPageToken;
fileFeedList = listRequest.Execute();
}
return ListOfFiles;
}
and how to delete a particular file:
public bool DeleteFileFromDrive(string FileID) // only to be used when you are the owner of the file. Otherwise it will have no effect.
{
try
{
FilesResource.GetRequest gr = new FilesResource.GetRequest(_CurrentDriveService, FileID);
var FileData = gr.Execute();
if (FileData.MimeType == GoogleDriveMimeTypes.GetFolderMimeTypeString())
{
var filesInFolder = GetFilesList("'" + FileID + "' in parents");
if (filesInFolder.Count > 0)
{
// directory is not empty
return false;
}
}
var requestD = _CurrentDriveService.Files.Delete(FileID);
requestD.Execute();
return true;
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Message);
return false;
}
}
What I figured out was that if you delete the file from service account using API(and because service account is the owner of that file), it will be deleted from all the Shared Drive Sections of the users who access the file. Thanks #some1, #MrRebot and #Hadar Ben David for helping me come up with this conclusion.
I have a google spreadsheet which will be used for collaboration and I was able to create a UI interface which will fetch and update data from a table to make it easier for users.
For the work I need to restrict users to only be able to update rows if they are assigned to them and I am able to do it. But along with that, I also need to allow administrator to assign or update rows which are not assigned to them.
I have a table with all employee's email address and an admin flag for those who are admin.
Name____________Email________________Is Admin
Employee 1_______emp1#domain.com_____Admin
Employee 2_______emp2#domain.com_____
Employee 3_______emp3#domain.com_____
Employee 4_______emp4#domain.com_____Admin
Employee 5_______emp5#domain.com_____
Employee 6_______emp6#domain.com_____
How can I write a something in my script that will allow me to if the user who is triggering a function has admin right or not.
I user Session.getActiveUser().getEmail() to pull out the users email address. I am creating the tool to be used within google apps domain.
Code that checks if the user is the owner of the row, this part works fine but what I want to do is if a user is admin they basically will skip this check.
if (s.getRange("E4").getValue() != usr()){
msg("Once a Task is assigned to an employee, only assigned employee can make any changes to the Task. Thank you");
return;
}
s = sheet
usr() = function calling to check active user email
If I can do something like countifs where I can check count based on the email address and Admin criteria and if its >= 1 proceed if its 0 show error that you can not make changes.
Please let me know.
Really appreciate the help.
Thank you.
Zooooon
Are you looking for something like this?
function myFunction() {
var s = SpreadsheetApp.getActiveSheet();
var usr = Session.getActiveUser().getEmail();
var emails = s.getRange("E2:F").getValues();
for (var i=0;i<emails.length;i++) {
if (emails[i][0] === usr){
if (emails[i][1] === "Admin") {
//Do something when Admin
return;
} else {
//Do something when not admin
return;
}
} else {
//Do something when email not in the list
}
}
}
I am assuming your data is in the range "D:F"
When I use Service account to add a new appointment, the organizer always the user of Credentials to Exchange service, I want to set the organizer to another user, but the organizer property is readonly, how can I achieve that?
var appointment = new Appointment(_service.ExchangeService);
if (exchangeAppointment.Participants.Any() && exchangeAppointment.Participants != null)
{
foreach (var participant in exchangeAppointment.Participants)
{
appointment.RequiredAttendees.Add(participant);
}
}
appointment.Resources.Add(exchangeAppointment.RoomAdIdentityEmail);
appointment.Location = string.Join(",", appointment.Resources);
appointment.Subject = exchangeAppointment.Subject;
appointment.Body = exchangeAppointment.Body;
appointment.Start = exchangeAppointment.StartTime;
appointment.End = exchangeAppointment.EndTime;
appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
The Organizer is going to be set based on the Calendar your saving the Appointment to, when you using a Service Account your creating the Appointment OnBehalf of the Organizer so you would need set the Save location to the calendar of the Organizer you want eg
Save(new FolderId(WellKnownFolderName.Calendar, "user#ddomain.com"), SendInvitationsMode.SendToAllAndSaveCopy);
The other option is to use EWS Impersonation and then Impersonate the Organizer http://msdn.microsoft.com/en-us/library/office/dd633680%28v=exchg.80%29.aspx
Cheers
Glen
I have 2 questions
I want to add the email Contact to Exchange server.I have seen the sample code using EWS.But that code used to add the contact for user specific.How to add the contact domain specific.
I want to get the domain contacts from Exchange server.I dont want all the contact i need only the today's added or modified contacts.
How can i acheive this .Can any one help me?
Regards
Vairamuthu.G.S
I did not understand "contact domain specific" but I will share you my code. It may help
Adding contact
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
// you should set the credentials of the user and
//call AutoDiscover to get the service URL before executing the code
Contact newcontact = new Contact(service);
newcontact.DisplayName = "data";
newcontact.EmailAddresses[EmailAddressKey.EmailAddress1] = new EmailAddress();
newcontact.EmailAddresses[EmailAddressKey.EmailAddress1].Address = "data";
newcontact.EmailAddresses[EmailAddressKey.EmailAddress1].Name = newcontact.DisplayName;
newcontact.FileAs = newcontact.DisplayName;
newcontact.Save();
Note that the new contact is saved in the contacts folder in the mailbox of the logging in user.
Filtering the retrieved contacts
SearchFilter filter = new SearchFilter.IsGreaterThan(ItemSchema.DateTimeCreated, DateTime.Now.AddDays(-1));
FindItemsResults<Item> contactCreatedToday = service.FindItems(WellKnownFolderName.Contacts, filter, new ItemView(int.MaxValue));
foreach (Item t in contactCreatedToday)
{
try
{
Contact c = (Contact) t;
//do processing
}
catch (InvalidCastException)
{
throw;
}
}
private function InviteMyFriends(e:MouseEvent):void{
var dat:Object = new Object();
dat.message = "Let's invite friends for our Super Krish QuizGame Facebook App to get bonus points";
dat.title = 'Super Krish QuizGame Facebook App';
// filtering for non app users only
dat.filters = ['app_non_users'];
//You can use these two options for diasplaying friends invitation window 'iframe' 'popup'
Facebook.ui('apprequests', dat, onUICallback, 'popup');
}
private function onUICallback(dat):void{
var result:Object = dat;
if(result == null){
mtline.trace2_txt.text = "User closed the pop up window without inviting any friends";
return
}
var invitedUsers:Array = new Array();
invitedUsers = result.request_ids as Array;
mtline.trace2_txt.text ="You Have Invited " + invitedUsers.length+ " friends";
//Simple if else if you want user to invite certain amount of friends
if(invitedUsers.length > 1){
mtline.trace2_txt.text = "GREAT, USER IS GENERATING TRAFFIC";
}else{
mtline.trace2_txt.text = "No Good, User invited only one friend ";
}
}
Hi,here i have used this code to send my facebook game invitation to my friends using facebook api with action scripting.its working perfectly but i need to identify my friends who accepted my invitation because i have to provide 500 points to the user who send the invitation to his friends after the invitation gets accepted.Kindly help regarding this.
Thanks in advance
That workflow you're proposing is explicitly against Facebook policy and your app could lose the ability to send requests as a result, just be aware of that before you proceed any further.
As for how to track accepted requests, you already have to read and delete the requests when the user clicks 'accept' on them, so you should log at send-time the request IDs and update your records when you're processing the accepted requests