How to create Multiple Users in Symfony2? - symfony-2.8

I am working on symfony project. Project is for posting job , and hiring employees.
I have created Admin and front end successfully.
Now what I want is to add multiple user in front end. I have 4 different type of users in front end.
Job Seeker (Candidate looking for new job)
Employees ( who post a job and hiring job seeker candidate)
Premium Employees ( who post a job and hiring job seeker candidate and have some more functionality then Employees )
Guest ( who can only see all the job seeker , Employees , Preminum Employees post )
I just need flow of this functionality after that I will implement all this myself.
So how can I implement this Functionality in Front end ?

I think according to what you try to do. You could give a try to pugx.
You will probably have to change your actual User but it could help you a lot.
PUGXMultiUserBundle
An other way would be to have one user Entity with many ROLE corresponding to what your user can do or not.
see Symfony Authorization documentation on the matter

Related

Using parameters to limit user access in SQL / Reporting Services

I'm looking at finding a way of restricting access to certain parts of a report using a parameter but I've yet to find a way to do this.
What I want to do is have the report get the persons username and then restrict what options they have available to them in the other parameters of the report.
For example, John is a manager of the Call Centre department so John
shouldn't see the options for the other departments in the business
and should only see the 'Call Centre' option in the Department
parameter.
Is this possible? If it isn't, is there an alternative using something similar?
First you'll need someway of determining who shoudl be able to see what. At it's simplest you could build a table to do this with Users and Departments.
Then create a dataset in your report that returns only values departments, something like
SELECT DepartmentID, DepartmentName FROM UserDepartments WHERE UserName = SYSTEM_USER
I've used SYSTEM_USER here but this will only work if you are executing the dataset with windows authentication.
Then in your Department parameter, just set the available values to the dataset you just created.

SoftLayer API: how to create a ticket

I am trying to create a SoftLayer ticket on behalf of customers, want to set assignedUserId and assignedEmployeeId, make the first update by employee id.
I tried to use client['Ticket'].createStandardTicket, but assignedEmployeeId was not set properly. Do you know how to get this implemented? Thank you so much in advance.
Unfortunately you won’t be able to assign an employee id since this parameter isn’t available in: http://sldn.softlayer.com/reference/datatypes/SoftLayer_ticket http://sldn.softlayer.com/reference/services/SoftLayer_Ticket/createStandardTicket
http://sldn.softlayer.com/reference/services/SoftLayer_Ticket/createAdministrativeTicket
This kind of tasks are managed by employees and it is an internal subject.

D2L / BrightSpace - Create user within a course and within a section and assign user a role

So I am trying to Enroll a user in a section for a particular org unit (Course)
This all works fine and I can add them into the section etc using:
POST /d2l/api/lp/(version)/(orgUnitId)/sections/(sectionId)/enrollments/¶
But the issue is, I am only able to POST one attribute, user ID. I need to be able to post the RoleID as well so I can specify whether they are a student or staff, as it assigned them 'teacher'.
Is there a way to do this / a different approach?
Cheers,
Alex.
Enrollments in Sections and Groups are effectively treated as special sub-components of a Course Offering; the APIs that let you enroll a user into a Section or Group therefore assume that you want to take the user/role enrolled in the parent course offering and "assign" them to this Group or that Section (with the same enrollment role).
You are correct that if you want to have them enrolled with a different role, you should instead use the general enrollments API (assuming you have permissions; your calling user context may well have permissions to assign a user to a group or a section, but not to enroll them generally).

Access controls list "Editing Odoo security rules"

I'm trying to modify the access control list of Leave Requests to approve under Leave managements module.
I need to make the Leave Requests to approve menu only accessed by each employee's manager.
ea. if the company has 10 employees under Sales/marketing and 5 employees under IT department. I need the sales manager access his 10 employees' leave requests only and not able to access the rest of company's employees who are not under his authority.
To do it, I modified the record rule domain definition of Leaves officer from [(1,'=',1)] to [('employee_id.parent_id,'=',user.id)]
but it didn't work. How to fix it?
In Your case basically your are totally pass the wrong domain for the record rules.
You are previously using the domain like
[(1,'=',1)] = > Access the all the model record for that model
[('employee_id.parent_id,'=',user.id)] = > Access the Manager parent_id as current user employee only
But in your are accessing only with the manager user only not to access its related user.
so you must have to add the below domain in your record rules:
['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id)]
Basically the manager its self as employee of the company and employee having to attached with its related user.
first Need to understand the following relation :
1. employee_id :
which is indicate the each leave related with one employee.
2. parent_id :
which is indicate the each employee related with one manager for hr.holidays model w[('employee_id.parent_id,'=',user.id)]particular model.hich is called the leave request
3. user_id :
If you want to access the login to the particular employee then and then you must have to set the related user for each employee form.which is labeled as Related User.
4. user :
Which is indicate the global user name means current user which you are currently logged in.
5.id :
means unique id for each record
In your case how the domain will work ?
first it will check the current logged in user as attached current leave employee related user or not.
and then then find the user ids which are having with the same employee attached with the same managers.
It means it will perform the OR operation of SQL Statement for both of the domain.
I hope my answer may helpful for you :)

Organising resource (URI) in REST API

Scenario 1
In my web application say for there is a screen for adding an employee to system. As soon as user tabs after entering name of the employee, it generates the employee code automatically (which is the next field) based on some logic and already present records in the database.
Now I want to expose rest API for this application so that third party devs can build on top of it. So, I will have a resource called as /Employee which will respond for GET, PUT and DELETE verbs. But when a client needs to autofill the code, which is a GET operation, it will be on what resource? Should I make a new resource /EmployeeCodeFor/{Name} or I should get it on /Employee/{Name}/GenerateCode? If I go with /Employee/{Name}/GenerateCode then what about my resource to GET, PUT and DELETE for Employee i.e. actually /Employee/{Id}?
Scenario 2
Here lets take the case of a stackoverflow post. So lets say the resource would be /Post/{Id}. In the same way as in the previous example it lists me possible duplicate question as soon as I tab out of the Title field.
Again on what URL I should get those possible duplicates?
I can't think of more scenarios just now. But many such kind of scenarios may come up in real life application development. How to implement them in RESTful way?
Update on scenario 1
Code and Id are two different fields. Id is primary key, code can be duplicate across departments just to illustrate. Also to generate a code, name should be provided first. So, if user types a name "FirstName LastName" then server might generate FL003 as code assuming that there are already two more employees with firstname starting from F and lastname starting from L in the said department. Department can be identified based on the logged in user.
One way to allow the server an opportunity to pre-fill a bunch of elements in a new resource is to do
POST /Employees
{with empty body}
=>
201 Created
Location: http://example.org/employee/3443
<Employee Id="3443">
<Code>E1001</Code>
<FirstName></FirstName>
<LastName></LastName>
</Employee>
This gives the server one chance to provide default values. If you are looking for a more interactive way for the server to provide feedback during the input, I have another approach but it will take quite a bit more explaining.
Scenario 1
Let say your employee code is a unique identifier. In this case, to get it, you would allow the user to complete any field for the new employee and then make a POST. The server would generate the code and respond to the POST with a link to /Employee/{generated_code} which is the record for your newly created employee.
A GET on /Employee would return a list of all employees. A GET on /Employee/{a_code} will give you the employee detail.
Scenario 2
You could have some kind of query on the /Post collection like /Post?title_like={question_title}. A GET /Post?title_like=REST How to would return you a list of all questions containing "REST How to".