access-rights

How to check a particular user has log on as service right programmatically

我的未来我决定 提交于 2019-12-03 14:33:03
For an application I what to check whether a particular user has log on as a service right? How to do this programmatically? I checked in the Internet and could not find out some good resource Thanks Upul Do you have a token for that account? If so you can call GetTokenInformation with TokenInformationClass == TokenPrivileges . That will return the list of privileges associated with the token and whether or not they have been activated. If the account isn't logged in and thus you can't get their token, it becomes much harder. You can't query for the privileges allowed for the account let alone

Why can't a PRIVATE member function be a friend function of another class?

三世轮回 提交于 2019-12-03 08:39:55
问题 class x { void xx() {} }; class y { friend void x::xx(); }; This results in an error like error: friend function 'xx' is a private member of 'x' Why can't I declare a private member function to be a friend of another class? 回答1: [class.friend]/9: A name nominated by a friend declaration shall be accessible in the scope of the class containing the friend declaration. The reason is quite simple; private members shall obey a clear and definite rule: A member of a class can be private ; that is,

Different REST resource content based on user viewing privileges

北城余情 提交于 2019-12-02 16:44:14
I want to provide different answers to the same question for different users, based on the access rights. I read this question: Excluding private data in RESTful response But I don't agree with the accepted answer, which states that you should provide both /people.xml and /unauthenticated/people.xml , since my understanding of REST is that a particular resource should live in a particular location, not several depending on how much of its information you're interested in. The system I'm designing is even more complicated than that one. Let's say that a user has created a number of circles of

Access base class protected members using pointers to base class in derived class

孤街浪徒 提交于 2019-12-02 07:58:52
问题 Consider the following code: #include <iostream> using std::endl; using std::cout; template<typename T> class B{ protected: T value; B* ptr; public: B(T t):value(t), ptr(0){} }; template<typename T> class D: public B<T>{ public: void f(); D(T t):B<T>(t){} }; template<typename T> void D<T>::f(){ cout << this->value << endl; //OK! this->ptr = this; cout << this->ptr->value << endl; //error! cannot access protected member!! B<T>* a = this; cout << a->value <<endl; //error! cannot access

Built-in Administrator account has no rights for some actions in Windows 10

不问归期 提交于 2019-11-30 09:05:33
问题 At some point I started getting following problems in Windows 10. Microsoft Visual Studio 15 is showing the following error when I'm trying to run compiled Windows universal application: Unable to activate Windows Store app ... The activation request failed with error 'This app can't be activated by the Built-in Administrator' After trying to personalize Windows 10 desktop I'm getting the error message: This app can't be open Settings can't be opened using Built-in Administrator account. Sign

Must a deleted constructor be private?

点点圈 提交于 2019-11-29 01:07:35
class A { public: A() = default; A(const A&) = delete; }; class A { public: A() = default; private: A(const A&) = delete; }; Are these two definitions always identical to each other in any cases? They are different only wrt the produced diagnostics . If you make it private , an additional and superfluous access violation is reported: class A { public: A() = default; private: A(const A&) = delete; }; int main() { A a; A a2=a; } results in the following additional output from GCC 4.8: main.cpp: In function 'int main()': main.cpp:6:5: error: 'A::A(const A&)' is private A(const A&) = delete; ^

How to solve “Microsoft Visual Studio (VS)” error “Unable to connect to the configured development Web server”

久未见 提交于 2019-11-28 03:55:49
PROBLEM If you start using " Microsoft Internet Information Services Express (IIS) " from " Microsoft Visual Studio (VS) " you may get when you run Build this error message Unable to connect to the configured development Web server . Failed to register URL "http://{ip_addr}:{port}/" for site "{project_name}" application "/". Error description: Access is denied. (0x80070005) What kind of rights is it? BG Bruno SOLUTION This means that you are missing the right for using it. Create it with Netsh Commands for Hypertext Transfer Protocol > add urlacl . 1) Open " Command Line Interface (CLI) "

Must a deleted constructor be private?

别等时光非礼了梦想. 提交于 2019-11-27 15:51:27
问题 class A { public: A() = default; A(const A&) = delete; }; class A { public: A() = default; private: A(const A&) = delete; }; Are these two definitions always identical to each other in any cases? 回答1: They are different only wrt the produced diagnostics . If you make it private , an additional and superfluous access violation is reported: class A { public: A() = default; private: A(const A&) = delete; }; int main() { A a; A a2=a; } results in the following additional output from GCC 4.8: main

Add “Everyone” privilege to folder using C#.NET

梦想的初衷 提交于 2019-11-26 04:19:12
问题 I have used the code below to allow Everyone access to a folder: System.Security.AccessControl.DirectorySecurity sec = System.IO.Directory.GetAccessControl(directory, AccessControlSections.All); FileSystemAccessRule accRule = new FileSystemAccessRule(\"Everyone\", FileSystemRights.Modify, AccessControlType.Allow); sec.AddAccessRule(accRule); // setACL sec.ResetAccessRule(accRule); Now, the Everyone user is added to the folder, but not with any rights assigned. All the read, write, execute etc